open-agents-ai 0.104.5 → 0.104.6
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 +149 -45
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31013,7 +31013,7 @@ async function fetchOpenAIModels(baseUrl, apiKey) {
|
|
|
31013
31013
|
async function fetchPeerModels(peerId, authKey) {
|
|
31014
31014
|
try {
|
|
31015
31015
|
const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
|
|
31016
|
-
const { existsSync: existsSync44, readFileSync:
|
|
31016
|
+
const { existsSync: existsSync44, readFileSync: readFileSync32 } = await import("node:fs");
|
|
31017
31017
|
const { join: join56 } = await import("node:path");
|
|
31018
31018
|
const cwd4 = process.cwd();
|
|
31019
31019
|
const nexusTool = new NexusTool2(cwd4);
|
|
@@ -31022,7 +31022,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
31022
31022
|
try {
|
|
31023
31023
|
const statusPath = join56(nexusDir, "status.json");
|
|
31024
31024
|
if (existsSync44(statusPath)) {
|
|
31025
|
-
const status = JSON.parse(
|
|
31025
|
+
const status = JSON.parse(readFileSync32(statusPath, "utf8"));
|
|
31026
31026
|
if (status.peerId === peerId)
|
|
31027
31027
|
isLocalPeer = true;
|
|
31028
31028
|
}
|
|
@@ -31032,7 +31032,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
31032
31032
|
const pricingPath = join56(nexusDir, "pricing.json");
|
|
31033
31033
|
if (existsSync44(pricingPath)) {
|
|
31034
31034
|
try {
|
|
31035
|
-
const pricing = JSON.parse(
|
|
31035
|
+
const pricing = JSON.parse(readFileSync32(pricingPath, "utf8"));
|
|
31036
31036
|
const localModels = (pricing.models || []).map((m) => ({
|
|
31037
31037
|
name: m.model || "unknown",
|
|
31038
31038
|
size: m.parameterSize || "",
|
|
@@ -31049,7 +31049,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
31049
31049
|
const cachePath = join56(nexusDir, "peer-models-cache.json");
|
|
31050
31050
|
if (existsSync44(cachePath)) {
|
|
31051
31051
|
try {
|
|
31052
|
-
const cache4 = JSON.parse(
|
|
31052
|
+
const cache4 = JSON.parse(readFileSync32(cachePath, "utf8"));
|
|
31053
31053
|
if (cache4.peerId === peerId && cache4.models?.length > 0) {
|
|
31054
31054
|
const age = Date.now() - new Date(cache4.cachedAt).getTime();
|
|
31055
31055
|
if (age < 5 * 60 * 1e3) {
|
|
@@ -31167,7 +31167,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
31167
31167
|
const pricingPath = join56(nexusDir, "pricing.json");
|
|
31168
31168
|
if (existsSync44(pricingPath)) {
|
|
31169
31169
|
try {
|
|
31170
|
-
const pricing = JSON.parse(
|
|
31170
|
+
const pricing = JSON.parse(readFileSync32(pricingPath, "utf8"));
|
|
31171
31171
|
return (pricing.models || []).map((m) => ({
|
|
31172
31172
|
name: m.model || "unknown",
|
|
31173
31173
|
size: m.parameterSize || "",
|
|
@@ -32094,7 +32094,7 @@ var init_oa_directory = __esm({
|
|
|
32094
32094
|
import * as readline from "node:readline";
|
|
32095
32095
|
import { execSync as execSync25, spawn as spawn17, exec as exec2 } from "node:child_process";
|
|
32096
32096
|
import { promisify as promisify5 } from "node:util";
|
|
32097
|
-
import { existsSync as existsSync31, writeFileSync as writeFileSync12, mkdirSync as mkdirSync12 } from "node:fs";
|
|
32097
|
+
import { existsSync as existsSync31, writeFileSync as writeFileSync12, readFileSync as readFileSync23, appendFileSync as appendFileSync2, mkdirSync as mkdirSync12 } from "node:fs";
|
|
32098
32098
|
import { join as join40 } from "node:path";
|
|
32099
32099
|
import { homedir as homedir10, platform } from "node:os";
|
|
32100
32100
|
function detectSystemSpecs() {
|
|
@@ -33672,6 +33672,105 @@ async function ensureExpandedContext(modelName, backendUrl) {
|
|
|
33672
33672
|
}
|
|
33673
33673
|
return { model: modelName, created: false, contextLabel: ctx.label, numCtx: ctx.numCtx };
|
|
33674
33674
|
}
|
|
33675
|
+
async function ensureNeovim() {
|
|
33676
|
+
try {
|
|
33677
|
+
const nvimPath = execSync25("which nvim 2>/dev/null || where nvim 2>nul", {
|
|
33678
|
+
encoding: "utf8",
|
|
33679
|
+
stdio: "pipe",
|
|
33680
|
+
timeout: 5e3
|
|
33681
|
+
}).trim();
|
|
33682
|
+
if (nvimPath)
|
|
33683
|
+
return nvimPath;
|
|
33684
|
+
} catch {
|
|
33685
|
+
}
|
|
33686
|
+
const platform5 = process.platform;
|
|
33687
|
+
const arch = process.arch;
|
|
33688
|
+
if (platform5 === "linux") {
|
|
33689
|
+
const binDir = join40(homedir10(), ".local", "bin");
|
|
33690
|
+
const nvimDest = join40(binDir, "nvim");
|
|
33691
|
+
try {
|
|
33692
|
+
mkdirSync12(binDir, { recursive: true });
|
|
33693
|
+
} catch {
|
|
33694
|
+
}
|
|
33695
|
+
const appImageName = arch === "arm64" ? "nvim-linux-arm64.appimage" : "nvim-linux-x86_64.appimage";
|
|
33696
|
+
const url = `https://github.com/neovim/neovim/releases/latest/download/${appImageName}`;
|
|
33697
|
+
console.log(` Downloading Neovim (${appImageName})...`);
|
|
33698
|
+
try {
|
|
33699
|
+
execSync25(`curl -fsSL "${url}" -o "${nvimDest}"`, { stdio: "pipe", timeout: 6e4 });
|
|
33700
|
+
execSync25(`chmod +x "${nvimDest}"`, { stdio: "pipe", timeout: 3e3 });
|
|
33701
|
+
} catch (err) {
|
|
33702
|
+
console.log(` Failed to download Neovim: ${err instanceof Error ? err.message : String(err)}`);
|
|
33703
|
+
return null;
|
|
33704
|
+
}
|
|
33705
|
+
try {
|
|
33706
|
+
const ver = execSync25(`"${nvimDest}" --version`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 }).split("\n")[0];
|
|
33707
|
+
console.log(` Installed: ${ver}`);
|
|
33708
|
+
} catch {
|
|
33709
|
+
console.log(" Warning: nvim binary downloaded but may not work (missing FUSE? Try: nvim --appimage-extract)");
|
|
33710
|
+
}
|
|
33711
|
+
if (!process.env.PATH?.includes(binDir)) {
|
|
33712
|
+
process.env.PATH = `${binDir}:${process.env.PATH}`;
|
|
33713
|
+
}
|
|
33714
|
+
ensurePathInShellRc(binDir);
|
|
33715
|
+
return nvimDest;
|
|
33716
|
+
}
|
|
33717
|
+
if (platform5 === "darwin") {
|
|
33718
|
+
if (hasCmd("brew")) {
|
|
33719
|
+
console.log(" Installing Neovim via Homebrew...");
|
|
33720
|
+
try {
|
|
33721
|
+
execSync25("brew install neovim", { stdio: "inherit", timeout: 12e4 });
|
|
33722
|
+
const nvimPath = execSync25("which nvim", { encoding: "utf8", stdio: "pipe", timeout: 3e3 }).trim();
|
|
33723
|
+
return nvimPath || null;
|
|
33724
|
+
} catch {
|
|
33725
|
+
console.log(" brew install neovim failed.");
|
|
33726
|
+
return null;
|
|
33727
|
+
}
|
|
33728
|
+
}
|
|
33729
|
+
console.log(" Homebrew not found. Install Neovim: brew install neovim");
|
|
33730
|
+
return null;
|
|
33731
|
+
}
|
|
33732
|
+
if (platform5 === "win32") {
|
|
33733
|
+
if (hasCmd("choco")) {
|
|
33734
|
+
console.log(" Installing Neovim via Chocolatey...");
|
|
33735
|
+
try {
|
|
33736
|
+
execSync25("choco install neovim -y", { stdio: "inherit", timeout: 12e4 });
|
|
33737
|
+
return "nvim";
|
|
33738
|
+
} catch {
|
|
33739
|
+
console.log(" choco install neovim failed.");
|
|
33740
|
+
}
|
|
33741
|
+
}
|
|
33742
|
+
if (hasCmd("winget")) {
|
|
33743
|
+
console.log(" Installing Neovim via winget...");
|
|
33744
|
+
try {
|
|
33745
|
+
execSync25("winget install Neovim.Neovim --accept-source-agreements --accept-package-agreements", {
|
|
33746
|
+
stdio: "inherit",
|
|
33747
|
+
timeout: 12e4
|
|
33748
|
+
});
|
|
33749
|
+
return "nvim";
|
|
33750
|
+
} catch {
|
|
33751
|
+
console.log(" winget install neovim failed.");
|
|
33752
|
+
}
|
|
33753
|
+
}
|
|
33754
|
+
console.log(" Install Neovim manually: https://neovim.io");
|
|
33755
|
+
return null;
|
|
33756
|
+
}
|
|
33757
|
+
return null;
|
|
33758
|
+
}
|
|
33759
|
+
function ensurePathInShellRc(binDir) {
|
|
33760
|
+
const shell = process.env.SHELL ?? "";
|
|
33761
|
+
const rcFile = shell.includes("zsh") ? join40(homedir10(), ".zshrc") : join40(homedir10(), ".bashrc");
|
|
33762
|
+
try {
|
|
33763
|
+
const rcContent = existsSync31(rcFile) ? readFileSync23(rcFile, "utf8") : "";
|
|
33764
|
+
if (rcContent.includes(binDir))
|
|
33765
|
+
return;
|
|
33766
|
+
const exportLine = `
|
|
33767
|
+
export PATH="${binDir}:$PATH" # Added by open-agents for nvim
|
|
33768
|
+
`;
|
|
33769
|
+
appendFileSync2(rcFile, exportLine, "utf8");
|
|
33770
|
+
console.log(` Added ${binDir} to ${rcFile}`);
|
|
33771
|
+
} catch {
|
|
33772
|
+
}
|
|
33773
|
+
}
|
|
33675
33774
|
var execAsync, QWEN_VARIANTS, TOOL_CALLING_MODELS, _cloudflaredInstallPromise;
|
|
33676
33775
|
var init_setup = __esm({
|
|
33677
33776
|
"packages/cli/dist/tui/setup.js"() {
|
|
@@ -34446,7 +34545,11 @@ async function startNeovimMode(opts) {
|
|
|
34446
34545
|
if (!nvimPath)
|
|
34447
34546
|
throw new Error();
|
|
34448
34547
|
} catch {
|
|
34449
|
-
|
|
34548
|
+
const installed = await ensureNeovim();
|
|
34549
|
+
if (!installed) {
|
|
34550
|
+
return "nvim not found and auto-install failed. Install Neovim: https://neovim.io";
|
|
34551
|
+
}
|
|
34552
|
+
nvimPath = installed;
|
|
34450
34553
|
}
|
|
34451
34554
|
let ptyMod;
|
|
34452
34555
|
try {
|
|
@@ -34726,6 +34829,7 @@ var isTTY5, _state;
|
|
|
34726
34829
|
var init_neovim_mode = __esm({
|
|
34727
34830
|
"packages/cli/dist/tui/neovim-mode.js"() {
|
|
34728
34831
|
"use strict";
|
|
34832
|
+
init_setup();
|
|
34729
34833
|
isTTY5 = process.stdout.isTTY ?? false;
|
|
34730
34834
|
_state = null;
|
|
34731
34835
|
}
|
|
@@ -34743,7 +34847,7 @@ __export(voice_exports, {
|
|
|
34743
34847
|
registerCustomOnnxModel: () => registerCustomOnnxModel,
|
|
34744
34848
|
resetNarrationContext: () => resetNarrationContext
|
|
34745
34849
|
});
|
|
34746
|
-
import { existsSync as existsSync34, mkdirSync as mkdirSync13, writeFileSync as writeFileSync13, readFileSync as
|
|
34850
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync13, writeFileSync as writeFileSync13, readFileSync as readFileSync24, unlinkSync as unlinkSync6, readdirSync as readdirSync9, renameSync, statSync as statSync10 } from "node:fs";
|
|
34747
34851
|
import { join as join42 } from "node:path";
|
|
34748
34852
|
import { homedir as homedir11, tmpdir as tmpdir7, platform as platform2 } from "node:os";
|
|
34749
34853
|
import { execSync as execSync27, spawn as nodeSpawn } from "node:child_process";
|
|
@@ -35697,7 +35801,7 @@ var init_voice = __esm({
|
|
|
35697
35801
|
const destFilename = `clone-${srcName}-${ts}.${ext}`;
|
|
35698
35802
|
const destPath = join42(refsDir, destFilename);
|
|
35699
35803
|
try {
|
|
35700
|
-
const data =
|
|
35804
|
+
const data = readFileSync24(audioPath);
|
|
35701
35805
|
writeFileSync13(destPath, data);
|
|
35702
35806
|
} catch (err) {
|
|
35703
35807
|
return `Failed to copy audio file: ${err instanceof Error ? err.message : String(err)}`;
|
|
@@ -35763,7 +35867,7 @@ var init_voice = __esm({
|
|
|
35763
35867
|
if (!existsSync34(p))
|
|
35764
35868
|
return {};
|
|
35765
35869
|
try {
|
|
35766
|
-
return JSON.parse(
|
|
35870
|
+
return JSON.parse(readFileSync24(p, "utf8"));
|
|
35767
35871
|
} catch {
|
|
35768
35872
|
return {};
|
|
35769
35873
|
}
|
|
@@ -36482,7 +36586,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
36482
36586
|
return;
|
|
36483
36587
|
if (volume !== 1) {
|
|
36484
36588
|
try {
|
|
36485
|
-
const wavData =
|
|
36589
|
+
const wavData = readFileSync24(wavPath);
|
|
36486
36590
|
if (wavData.length > 44) {
|
|
36487
36591
|
const header = wavData.subarray(0, 44);
|
|
36488
36592
|
const samples = new Int16Array(wavData.buffer, wavData.byteOffset + 44, (wavData.length - 44) / 2);
|
|
@@ -36497,7 +36601,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
36497
36601
|
}
|
|
36498
36602
|
if (this.onPCMOutput) {
|
|
36499
36603
|
try {
|
|
36500
|
-
const wavData =
|
|
36604
|
+
const wavData = readFileSync24(wavPath);
|
|
36501
36605
|
if (wavData.length > 44) {
|
|
36502
36606
|
const pcm = Buffer.from(wavData.buffer, wavData.byteOffset + 44, wavData.length - 44);
|
|
36503
36607
|
const sampleRate = wavData.readUInt32LE(24);
|
|
@@ -36549,7 +36653,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
36549
36653
|
if (!existsSync34(wavPath))
|
|
36550
36654
|
return null;
|
|
36551
36655
|
try {
|
|
36552
|
-
const data =
|
|
36656
|
+
const data = readFileSync24(wavPath);
|
|
36553
36657
|
unlinkSync6(wavPath);
|
|
36554
36658
|
return data;
|
|
36555
36659
|
} catch {
|
|
@@ -36902,7 +37006,7 @@ if __name__ == '__main__':
|
|
|
36902
37006
|
return;
|
|
36903
37007
|
if (volume !== 1) {
|
|
36904
37008
|
try {
|
|
36905
|
-
const wavData =
|
|
37009
|
+
const wavData = readFileSync24(wavPath);
|
|
36906
37010
|
if (wavData.length > 44) {
|
|
36907
37011
|
const samples = new Int16Array(wavData.buffer, wavData.byteOffset + 44, (wavData.length - 44) / 2);
|
|
36908
37012
|
for (let i = 0; i < samples.length; i++) {
|
|
@@ -36917,7 +37021,7 @@ if __name__ == '__main__':
|
|
|
36917
37021
|
}
|
|
36918
37022
|
if (pitchFactor !== 1) {
|
|
36919
37023
|
try {
|
|
36920
|
-
const wavData =
|
|
37024
|
+
const wavData = readFileSync24(wavPath);
|
|
36921
37025
|
if (wavData.length > 44) {
|
|
36922
37026
|
const int16 = new Int16Array(wavData.buffer, wavData.byteOffset + 44, (wavData.length - 44) / 2);
|
|
36923
37027
|
const float32 = new Float32Array(int16.length);
|
|
@@ -36932,7 +37036,7 @@ if __name__ == '__main__':
|
|
|
36932
37036
|
}
|
|
36933
37037
|
if (this.onPCMOutput) {
|
|
36934
37038
|
try {
|
|
36935
|
-
const wavData =
|
|
37039
|
+
const wavData = readFileSync24(wavPath);
|
|
36936
37040
|
if (wavData.length > 44) {
|
|
36937
37041
|
const pcm = Buffer.from(wavData.buffer, wavData.byteOffset + 44, wavData.length - 44);
|
|
36938
37042
|
const sampleRate = wavData.readUInt32LE(24);
|
|
@@ -36975,7 +37079,7 @@ if __name__ == '__main__':
|
|
|
36975
37079
|
if (!existsSync34(wavPath))
|
|
36976
37080
|
return null;
|
|
36977
37081
|
try {
|
|
36978
|
-
const data =
|
|
37082
|
+
const data = readFileSync24(wavPath);
|
|
36979
37083
|
unlinkSync6(wavPath);
|
|
36980
37084
|
return data;
|
|
36981
37085
|
} catch {
|
|
@@ -36997,7 +37101,7 @@ if __name__ == '__main__':
|
|
|
36997
37101
|
};
|
|
36998
37102
|
if (existsSync34(pkgPath)) {
|
|
36999
37103
|
try {
|
|
37000
|
-
const existing = JSON.parse(
|
|
37104
|
+
const existing = JSON.parse(readFileSync24(pkgPath, "utf8"));
|
|
37001
37105
|
if (!existing.dependencies?.["phonemizer"]) {
|
|
37002
37106
|
existing.dependencies = { ...existing.dependencies, ...expectedDeps };
|
|
37003
37107
|
writeFileSync13(pkgPath, JSON.stringify(existing, null, 2));
|
|
@@ -37132,7 +37236,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
|
37132
37236
|
if (!existsSync34(onnxPath) || !existsSync34(configPath)) {
|
|
37133
37237
|
throw new Error(`Model files not found for ${this.modelId}`);
|
|
37134
37238
|
}
|
|
37135
|
-
this.config = JSON.parse(
|
|
37239
|
+
this.config = JSON.parse(readFileSync24(configPath, "utf8"));
|
|
37136
37240
|
this.session = await this.ort.InferenceSession.create(onnxPath, {
|
|
37137
37241
|
executionProviders: ["cpu"],
|
|
37138
37242
|
graphOptimizationLevel: "all"
|
|
@@ -40128,7 +40232,7 @@ var init_commands = __esm({
|
|
|
40128
40232
|
});
|
|
40129
40233
|
|
|
40130
40234
|
// packages/cli/dist/tui/project-context.js
|
|
40131
|
-
import { existsSync as existsSync35, readFileSync as
|
|
40235
|
+
import { existsSync as existsSync35, readFileSync as readFileSync25, readdirSync as readdirSync10 } from "node:fs";
|
|
40132
40236
|
import { join as join43, basename as basename10 } from "node:path";
|
|
40133
40237
|
import { execSync as execSync28 } from "node:child_process";
|
|
40134
40238
|
import { homedir as homedir12, platform as platform3, release } from "node:os";
|
|
@@ -40167,7 +40271,7 @@ function loadProjectMap(repoRoot) {
|
|
|
40167
40271
|
const mapPath = join43(repoRoot, OA_DIR, "context", "project-map.md");
|
|
40168
40272
|
if (existsSync35(mapPath)) {
|
|
40169
40273
|
try {
|
|
40170
|
-
const content =
|
|
40274
|
+
const content = readFileSync25(mapPath, "utf-8");
|
|
40171
40275
|
return content;
|
|
40172
40276
|
} catch {
|
|
40173
40277
|
}
|
|
@@ -40232,7 +40336,7 @@ function loadMemoryDir(memDir, scope) {
|
|
|
40232
40336
|
const files = readdirSync10(memDir).filter((f) => f.endsWith(".json"));
|
|
40233
40337
|
for (const file of files.slice(0, 10)) {
|
|
40234
40338
|
try {
|
|
40235
|
-
const raw =
|
|
40339
|
+
const raw = readFileSync25(join43(memDir, file), "utf-8");
|
|
40236
40340
|
const entries = JSON.parse(raw);
|
|
40237
40341
|
const topic = basename10(file, ".json");
|
|
40238
40342
|
const keys = Object.keys(entries);
|
|
@@ -41255,14 +41359,14 @@ var init_carousel = __esm({
|
|
|
41255
41359
|
});
|
|
41256
41360
|
|
|
41257
41361
|
// packages/cli/dist/tui/carousel-descriptors.js
|
|
41258
|
-
import { existsSync as existsSync36, readFileSync as
|
|
41362
|
+
import { existsSync as existsSync36, readFileSync as readFileSync26, writeFileSync as writeFileSync14, mkdirSync as mkdirSync14, readdirSync as readdirSync11 } from "node:fs";
|
|
41259
41363
|
import { join as join44, basename as basename11 } from "node:path";
|
|
41260
41364
|
function loadToolProfile(repoRoot) {
|
|
41261
41365
|
const filePath = join44(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
|
|
41262
41366
|
try {
|
|
41263
41367
|
if (!existsSync36(filePath))
|
|
41264
41368
|
return null;
|
|
41265
|
-
return JSON.parse(
|
|
41369
|
+
return JSON.parse(readFileSync26(filePath, "utf-8"));
|
|
41266
41370
|
} catch {
|
|
41267
41371
|
return null;
|
|
41268
41372
|
}
|
|
@@ -41332,7 +41436,7 @@ function loadCachedDescriptors(repoRoot) {
|
|
|
41332
41436
|
try {
|
|
41333
41437
|
if (!existsSync36(filePath))
|
|
41334
41438
|
return null;
|
|
41335
|
-
const cached = JSON.parse(
|
|
41439
|
+
const cached = JSON.parse(readFileSync26(filePath, "utf-8"));
|
|
41336
41440
|
return cached.phrases.length > 0 ? cached.phrases : null;
|
|
41337
41441
|
} catch {
|
|
41338
41442
|
return null;
|
|
@@ -41398,7 +41502,7 @@ function extractFromPackageJson(repoRoot, tags) {
|
|
|
41398
41502
|
try {
|
|
41399
41503
|
if (!existsSync36(pkgPath))
|
|
41400
41504
|
return;
|
|
41401
|
-
const pkg = JSON.parse(
|
|
41505
|
+
const pkg = JSON.parse(readFileSync26(pkgPath, "utf-8"));
|
|
41402
41506
|
if (pkg.name && typeof pkg.name === "string") {
|
|
41403
41507
|
const parts = pkg.name.replace(/^@/, "").split("/");
|
|
41404
41508
|
for (const p of parts)
|
|
@@ -41473,7 +41577,7 @@ function extractFromMemory(repoRoot, tags) {
|
|
|
41473
41577
|
const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
|
|
41474
41578
|
tags.push(topic);
|
|
41475
41579
|
try {
|
|
41476
|
-
const data = JSON.parse(
|
|
41580
|
+
const data = JSON.parse(readFileSync26(join44(memoryDir, file), "utf-8"));
|
|
41477
41581
|
if (data && typeof data === "object") {
|
|
41478
41582
|
const keys = Object.keys(data).slice(0, 3);
|
|
41479
41583
|
for (const key of keys) {
|
|
@@ -42095,7 +42199,7 @@ var init_stream_renderer = __esm({
|
|
|
42095
42199
|
});
|
|
42096
42200
|
|
|
42097
42201
|
// packages/cli/dist/tui/edit-history.js
|
|
42098
|
-
import { appendFileSync as
|
|
42202
|
+
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync15 } from "node:fs";
|
|
42099
42203
|
import { join as join45 } from "node:path";
|
|
42100
42204
|
function createEditHistoryLogger(repoRoot, sessionId) {
|
|
42101
42205
|
const historyDir = join45(repoRoot, ".oa", "history");
|
|
@@ -42117,7 +42221,7 @@ function createEditHistoryLogger(repoRoot, sessionId) {
|
|
|
42117
42221
|
args: sanitizeArgs(toolName, toolArgs)
|
|
42118
42222
|
};
|
|
42119
42223
|
try {
|
|
42120
|
-
|
|
42224
|
+
appendFileSync3(logPath, JSON.stringify(entry) + "\n", "utf-8");
|
|
42121
42225
|
} catch {
|
|
42122
42226
|
}
|
|
42123
42227
|
}
|
|
@@ -42210,7 +42314,7 @@ var init_edit_history = __esm({
|
|
|
42210
42314
|
});
|
|
42211
42315
|
|
|
42212
42316
|
// packages/cli/dist/tui/promptLoader.js
|
|
42213
|
-
import { readFileSync as
|
|
42317
|
+
import { readFileSync as readFileSync27, existsSync as existsSync37 } from "node:fs";
|
|
42214
42318
|
import { join as join46, dirname as dirname17 } from "node:path";
|
|
42215
42319
|
import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
42216
42320
|
function loadPrompt3(promptPath, vars) {
|
|
@@ -42220,7 +42324,7 @@ function loadPrompt3(promptPath, vars) {
|
|
|
42220
42324
|
if (!existsSync37(fullPath)) {
|
|
42221
42325
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
42222
42326
|
}
|
|
42223
|
-
content =
|
|
42327
|
+
content = readFileSync27(fullPath, "utf-8");
|
|
42224
42328
|
cache3.set(promptPath, content);
|
|
42225
42329
|
}
|
|
42226
42330
|
if (!vars)
|
|
@@ -42241,7 +42345,7 @@ var init_promptLoader3 = __esm({
|
|
|
42241
42345
|
});
|
|
42242
42346
|
|
|
42243
42347
|
// packages/cli/dist/tui/dream-engine.js
|
|
42244
|
-
import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync15, readFileSync as
|
|
42348
|
+
import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync15, readFileSync as readFileSync28, existsSync as existsSync38, cpSync, rmSync, readdirSync as readdirSync12 } from "node:fs";
|
|
42245
42349
|
import { join as join47, basename as basename12 } from "node:path";
|
|
42246
42350
|
import { execSync as execSync29 } from "node:child_process";
|
|
42247
42351
|
function loadAutoresearchMemory(repoRoot) {
|
|
@@ -42249,7 +42353,7 @@ function loadAutoresearchMemory(repoRoot) {
|
|
|
42249
42353
|
if (!existsSync38(memoryPath))
|
|
42250
42354
|
return "";
|
|
42251
42355
|
try {
|
|
42252
|
-
const raw =
|
|
42356
|
+
const raw = readFileSync28(memoryPath, "utf-8");
|
|
42253
42357
|
const data = JSON.parse(raw);
|
|
42254
42358
|
const sections = [];
|
|
42255
42359
|
for (const key of AUTORESEARCH_MEMORY_KEYS) {
|
|
@@ -42482,7 +42586,7 @@ var init_dream_engine = __esm({
|
|
|
42482
42586
|
if (!existsSync38(targetPath)) {
|
|
42483
42587
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start };
|
|
42484
42588
|
}
|
|
42485
|
-
let content =
|
|
42589
|
+
let content = readFileSync28(targetPath, "utf-8");
|
|
42486
42590
|
if (!content.includes(oldStr)) {
|
|
42487
42591
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start };
|
|
42488
42592
|
}
|
|
@@ -42571,7 +42675,7 @@ var init_dream_engine = __esm({
|
|
|
42571
42675
|
if (!existsSync38(targetPath)) {
|
|
42572
42676
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start };
|
|
42573
42677
|
}
|
|
42574
|
-
let content =
|
|
42678
|
+
let content = readFileSync28(targetPath, "utf-8");
|
|
42575
42679
|
if (!content.includes(oldStr)) {
|
|
42576
42680
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start };
|
|
42577
42681
|
}
|
|
@@ -43849,7 +43953,7 @@ var init_bless_engine = __esm({
|
|
|
43849
43953
|
});
|
|
43850
43954
|
|
|
43851
43955
|
// packages/cli/dist/tui/dmn-engine.js
|
|
43852
|
-
import { existsSync as existsSync39, readFileSync as
|
|
43956
|
+
import { existsSync as existsSync39, readFileSync as readFileSync29, writeFileSync as writeFileSync16, mkdirSync as mkdirSync17, readdirSync as readdirSync13, unlinkSync as unlinkSync7 } from "node:fs";
|
|
43853
43957
|
import { join as join48, basename as basename13 } from "node:path";
|
|
43854
43958
|
function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
|
|
43855
43959
|
const competenceReport = competence.length > 0 ? competence.map((c3) => {
|
|
@@ -44577,7 +44681,7 @@ OUTPUT: Call task_complete with JSON:
|
|
|
44577
44681
|
const path = join48(this.stateDir, "state.json");
|
|
44578
44682
|
if (existsSync39(path)) {
|
|
44579
44683
|
try {
|
|
44580
|
-
this.state = JSON.parse(
|
|
44684
|
+
this.state = JSON.parse(readFileSync29(path, "utf-8"));
|
|
44581
44685
|
} catch {
|
|
44582
44686
|
}
|
|
44583
44687
|
}
|
|
@@ -44609,7 +44713,7 @@ OUTPUT: Call task_complete with JSON:
|
|
|
44609
44713
|
});
|
|
44610
44714
|
|
|
44611
44715
|
// packages/cli/dist/tui/snr-engine.js
|
|
44612
|
-
import { existsSync as existsSync40, readdirSync as readdirSync14, readFileSync as
|
|
44716
|
+
import { existsSync as existsSync40, readdirSync as readdirSync14, readFileSync as readFileSync30 } from "node:fs";
|
|
44613
44717
|
import { join as join49, basename as basename14 } from "node:path";
|
|
44614
44718
|
function computeDPrime(signalScores, noiseScores) {
|
|
44615
44719
|
if (signalScores.length === 0 || noiseScores.length === 0)
|
|
@@ -44863,7 +44967,7 @@ Call task_complete with the JSON array when done.`, onEvent)
|
|
|
44863
44967
|
if (topics.length > 0 && !topics.includes(topic))
|
|
44864
44968
|
continue;
|
|
44865
44969
|
try {
|
|
44866
|
-
const data = JSON.parse(
|
|
44970
|
+
const data = JSON.parse(readFileSync30(join49(dir, f), "utf-8"));
|
|
44867
44971
|
for (const [key, val] of Object.entries(data)) {
|
|
44868
44972
|
const value = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
44869
44973
|
entries.push({ topic, key, value });
|
|
@@ -48544,7 +48648,7 @@ import { cwd } from "node:process";
|
|
|
48544
48648
|
import { resolve as resolve29, join as join51, dirname as dirname18, extname as extname10 } from "node:path";
|
|
48545
48649
|
import { createRequire as createRequire2 } from "node:module";
|
|
48546
48650
|
import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
48547
|
-
import { readFileSync as
|
|
48651
|
+
import { readFileSync as readFileSync31, writeFileSync as writeFileSync17, appendFileSync as appendFileSync4, rmSync as rmSync2, readdirSync as readdirSync16, mkdirSync as mkdirSync19 } from "node:fs";
|
|
48548
48652
|
import { existsSync as existsSync42 } from "node:fs";
|
|
48549
48653
|
import { homedir as homedir13 } from "node:os";
|
|
48550
48654
|
function formatTimeAgo(date) {
|
|
@@ -48785,7 +48889,7 @@ function gatherMemorySnippets(root) {
|
|
|
48785
48889
|
continue;
|
|
48786
48890
|
try {
|
|
48787
48891
|
for (const f of readdirSync16(dir).filter((f2) => f2.endsWith(".json"))) {
|
|
48788
|
-
const data = JSON.parse(
|
|
48892
|
+
const data = JSON.parse(readFileSync31(join51(dir, f), "utf-8"));
|
|
48789
48893
|
for (const val of Object.values(data)) {
|
|
48790
48894
|
const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
48791
48895
|
if (v.length > 10)
|
|
@@ -49912,7 +50016,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
49912
50016
|
let savedHistory = [];
|
|
49913
50017
|
try {
|
|
49914
50018
|
if (existsSync42(HISTORY_FILE)) {
|
|
49915
|
-
const raw =
|
|
50019
|
+
const raw = readFileSync31(HISTORY_FILE, "utf8").trim();
|
|
49916
50020
|
if (raw)
|
|
49917
50021
|
savedHistory = raw.split("\n").reverse();
|
|
49918
50022
|
}
|
|
@@ -49932,9 +50036,9 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
49932
50036
|
return;
|
|
49933
50037
|
try {
|
|
49934
50038
|
mkdirSync19(HISTORY_DIR, { recursive: true });
|
|
49935
|
-
|
|
50039
|
+
appendFileSync4(HISTORY_FILE, line + "\n", "utf8");
|
|
49936
50040
|
if (Math.random() < 0.02) {
|
|
49937
|
-
const all =
|
|
50041
|
+
const all = readFileSync31(HISTORY_FILE, "utf8").trim().split("\n");
|
|
49938
50042
|
if (all.length > MAX_HISTORY_LINES) {
|
|
49939
50043
|
writeFileSync17(HISTORY_FILE, all.slice(-MAX_HISTORY_LINES).join("\n") + "\n", "utf8");
|
|
49940
50044
|
}
|
|
@@ -51531,7 +51635,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
51531
51635
|
if (isImage) {
|
|
51532
51636
|
try {
|
|
51533
51637
|
const imgPath = resolve29(repoRoot, cleanPath);
|
|
51534
|
-
const imgBuffer =
|
|
51638
|
+
const imgBuffer = readFileSync31(imgPath);
|
|
51535
51639
|
const base64 = imgBuffer.toString("base64");
|
|
51536
51640
|
const ext = extname10(cleanPath).toLowerCase();
|
|
51537
51641
|
const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
|
package/package.json
CHANGED