open-agents-ai 0.139.7 → 0.139.9
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 +566 -328
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10892,8 +10892,8 @@ async function loadTranscribeCli() {
|
|
|
10892
10892
|
const nvmBase = join17(homedir6(), ".nvm", "versions", "node");
|
|
10893
10893
|
if (existsSync14(nvmBase)) {
|
|
10894
10894
|
try {
|
|
10895
|
-
const { readdirSync:
|
|
10896
|
-
for (const ver of
|
|
10895
|
+
const { readdirSync: readdirSync18 } = await import("node:fs");
|
|
10896
|
+
for (const ver of readdirSync18(nvmBase)) {
|
|
10897
10897
|
const tcPath = join17(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
|
|
10898
10898
|
if (existsSync14(join17(tcPath, "dist", "index.js"))) {
|
|
10899
10899
|
const { createRequire: createRequire4 } = await import("node:module");
|
|
@@ -12531,9 +12531,9 @@ print("${sentinel}")
|
|
|
12531
12531
|
if (!this.proc || this.proc.killed) {
|
|
12532
12532
|
return { success: false, path: "" };
|
|
12533
12533
|
}
|
|
12534
|
-
const { mkdirSync:
|
|
12534
|
+
const { mkdirSync: mkdirSync22, writeFileSync: writeFileSync21 } = await import("node:fs");
|
|
12535
12535
|
const sessionDir = join20(this.cwd, ".oa", "rlm");
|
|
12536
|
-
|
|
12536
|
+
mkdirSync22(sessionDir, { recursive: true });
|
|
12537
12537
|
const sessionPath = join20(sessionDir, "session.json");
|
|
12538
12538
|
try {
|
|
12539
12539
|
const inspectCode = `
|
|
@@ -12557,7 +12557,7 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
|
|
|
12557
12557
|
trajectoryCount: this.trajectory.length,
|
|
12558
12558
|
subCallCount: this.subCallCount
|
|
12559
12559
|
};
|
|
12560
|
-
|
|
12560
|
+
writeFileSync21(sessionPath, JSON.stringify(sessionData, null, 2), "utf8");
|
|
12561
12561
|
return { success: true, path: sessionPath };
|
|
12562
12562
|
}
|
|
12563
12563
|
} catch {
|
|
@@ -12569,11 +12569,11 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
|
|
|
12569
12569
|
* what was previously computed. */
|
|
12570
12570
|
async loadSessionInfo() {
|
|
12571
12571
|
try {
|
|
12572
|
-
const { readFileSync:
|
|
12572
|
+
const { readFileSync: readFileSync34, existsSync: existsSync46 } = await import("node:fs");
|
|
12573
12573
|
const sessionPath = join20(this.cwd, ".oa", "rlm", "session.json");
|
|
12574
|
-
if (!
|
|
12574
|
+
if (!existsSync46(sessionPath))
|
|
12575
12575
|
return null;
|
|
12576
|
-
return JSON.parse(
|
|
12576
|
+
return JSON.parse(readFileSync34(sessionPath, "utf8"));
|
|
12577
12577
|
} catch {
|
|
12578
12578
|
return null;
|
|
12579
12579
|
}
|
|
@@ -12750,10 +12750,10 @@ var init_memory_metabolism = __esm({
|
|
|
12750
12750
|
const trajDir = join21(this.cwd, ".oa", "rlm-trajectories");
|
|
12751
12751
|
let lessons = [];
|
|
12752
12752
|
try {
|
|
12753
|
-
const { readdirSync:
|
|
12754
|
-
const files =
|
|
12753
|
+
const { readdirSync: readdirSync18, readFileSync: readFileSync34 } = await import("node:fs");
|
|
12754
|
+
const files = readdirSync18(trajDir).filter((f) => f.endsWith(".jsonl")).sort().reverse().slice(0, 3);
|
|
12755
12755
|
for (const file of files) {
|
|
12756
|
-
const lines =
|
|
12756
|
+
const lines = readFileSync34(join21(trajDir, file), "utf8").split("\n").filter((l) => l.trim());
|
|
12757
12757
|
for (const line of lines) {
|
|
12758
12758
|
try {
|
|
12759
12759
|
const entry = JSON.parse(line);
|
|
@@ -13137,14 +13137,14 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
|
|
|
13137
13137
|
* Optionally filter by task type for phase-aware context (FSM paper insight).
|
|
13138
13138
|
*/
|
|
13139
13139
|
getTopMemoriesSync(k = 5, taskType) {
|
|
13140
|
-
const { readFileSync:
|
|
13140
|
+
const { readFileSync: readFileSync34, existsSync: existsSync46 } = __require("node:fs");
|
|
13141
13141
|
const metaDir = join21(this.cwd, ".oa", "memory", "metabolism");
|
|
13142
13142
|
const storeFile = join21(metaDir, "store.json");
|
|
13143
|
-
if (!
|
|
13143
|
+
if (!existsSync46(storeFile))
|
|
13144
13144
|
return "";
|
|
13145
13145
|
let store = [];
|
|
13146
13146
|
try {
|
|
13147
|
-
store = JSON.parse(
|
|
13147
|
+
store = JSON.parse(readFileSync34(storeFile, "utf8"));
|
|
13148
13148
|
} catch {
|
|
13149
13149
|
return "";
|
|
13150
13150
|
}
|
|
@@ -13166,14 +13166,14 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
|
|
|
13166
13166
|
/** Update memory scores based on task outcome. Called after task completion.
|
|
13167
13167
|
* Memories used in successful tasks get boosted. Memories present during failures get decayed. */
|
|
13168
13168
|
updateFromOutcomeSync(surfacedMemoryText, succeeded) {
|
|
13169
|
-
const { readFileSync:
|
|
13169
|
+
const { readFileSync: readFileSync34, writeFileSync: writeFileSync21, existsSync: existsSync46, mkdirSync: mkdirSync22 } = __require("node:fs");
|
|
13170
13170
|
const metaDir = join21(this.cwd, ".oa", "memory", "metabolism");
|
|
13171
13171
|
const storeFile = join21(metaDir, "store.json");
|
|
13172
|
-
if (!
|
|
13172
|
+
if (!existsSync46(storeFile))
|
|
13173
13173
|
return;
|
|
13174
13174
|
let store = [];
|
|
13175
13175
|
try {
|
|
13176
|
-
store = JSON.parse(
|
|
13176
|
+
store = JSON.parse(readFileSync34(storeFile, "utf8"));
|
|
13177
13177
|
} catch {
|
|
13178
13178
|
return;
|
|
13179
13179
|
}
|
|
@@ -13197,8 +13197,8 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
|
|
|
13197
13197
|
updated = true;
|
|
13198
13198
|
}
|
|
13199
13199
|
if (updated) {
|
|
13200
|
-
|
|
13201
|
-
|
|
13200
|
+
mkdirSync22(metaDir, { recursive: true });
|
|
13201
|
+
writeFileSync21(storeFile, JSON.stringify(store, null, 2));
|
|
13202
13202
|
}
|
|
13203
13203
|
}
|
|
13204
13204
|
// ── Storage ──────────────────────────────────────────────────────────
|
|
@@ -13620,13 +13620,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
13620
13620
|
// Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
|
|
13621
13621
|
/** Retrieve top-K strategies for context injection. Returns "" if none. */
|
|
13622
13622
|
getRelevantStrategiesSync(k = 3, taskType) {
|
|
13623
|
-
const { readFileSync:
|
|
13623
|
+
const { readFileSync: readFileSync34, existsSync: existsSync46 } = __require("node:fs");
|
|
13624
13624
|
const archiveFile = join23(this.cwd, ".oa", "arche", "variants.json");
|
|
13625
|
-
if (!
|
|
13625
|
+
if (!existsSync46(archiveFile))
|
|
13626
13626
|
return "";
|
|
13627
13627
|
let variants = [];
|
|
13628
13628
|
try {
|
|
13629
|
-
variants = JSON.parse(
|
|
13629
|
+
variants = JSON.parse(readFileSync34(archiveFile, "utf8"));
|
|
13630
13630
|
} catch {
|
|
13631
13631
|
return "";
|
|
13632
13632
|
}
|
|
@@ -13644,13 +13644,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
13644
13644
|
}
|
|
13645
13645
|
/** Archive a strategy variant synchronously (for task completion path) */
|
|
13646
13646
|
archiveVariantSync(strategy, outcome, tags = []) {
|
|
13647
|
-
const { readFileSync:
|
|
13647
|
+
const { readFileSync: readFileSync34, writeFileSync: writeFileSync21, existsSync: existsSync46, mkdirSync: mkdirSync22 } = __require("node:fs");
|
|
13648
13648
|
const dir = join23(this.cwd, ".oa", "arche");
|
|
13649
13649
|
const archiveFile = join23(dir, "variants.json");
|
|
13650
13650
|
let variants = [];
|
|
13651
13651
|
try {
|
|
13652
|
-
if (
|
|
13653
|
-
variants = JSON.parse(
|
|
13652
|
+
if (existsSync46(archiveFile))
|
|
13653
|
+
variants = JSON.parse(readFileSync34(archiveFile, "utf8"));
|
|
13654
13654
|
} catch {
|
|
13655
13655
|
}
|
|
13656
13656
|
variants.push({
|
|
@@ -13665,8 +13665,8 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
13665
13665
|
});
|
|
13666
13666
|
if (variants.length > 50)
|
|
13667
13667
|
variants = variants.slice(-50);
|
|
13668
|
-
|
|
13669
|
-
|
|
13668
|
+
mkdirSync22(dir, { recursive: true });
|
|
13669
|
+
writeFileSync21(archiveFile, JSON.stringify(variants, null, 2));
|
|
13670
13670
|
}
|
|
13671
13671
|
async saveArchive(variants) {
|
|
13672
13672
|
const dir = join23(this.cwd, ".oa", "arche");
|
|
@@ -23755,10 +23755,10 @@ ${marker}` : marker);
|
|
|
23755
23755
|
if (!this._workingDirectory)
|
|
23756
23756
|
return;
|
|
23757
23757
|
try {
|
|
23758
|
-
const { mkdirSync:
|
|
23759
|
-
const { join:
|
|
23760
|
-
const sessionDir =
|
|
23761
|
-
|
|
23758
|
+
const { mkdirSync: mkdirSync22, writeFileSync: writeFileSync21 } = __require("node:fs");
|
|
23759
|
+
const { join: join65 } = __require("node:path");
|
|
23760
|
+
const sessionDir = join65(this._workingDirectory, ".oa", "session", this._sessionId);
|
|
23761
|
+
mkdirSync22(sessionDir, { recursive: true });
|
|
23762
23762
|
const checkpoint = {
|
|
23763
23763
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23764
23764
|
sessionId: this._sessionId,
|
|
@@ -23770,7 +23770,7 @@ ${marker}` : marker);
|
|
|
23770
23770
|
memexEntryCount: this._memexArchive.size,
|
|
23771
23771
|
fileRegistrySize: this._fileRegistry.size
|
|
23772
23772
|
};
|
|
23773
|
-
|
|
23773
|
+
writeFileSync21(join65(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
|
|
23774
23774
|
} catch {
|
|
23775
23775
|
}
|
|
23776
23776
|
}
|
|
@@ -26636,8 +26636,8 @@ var init_listen = __esm({
|
|
|
26636
26636
|
const nvmBase = join42(homedir8(), ".nvm", "versions", "node");
|
|
26637
26637
|
if (existsSync27(nvmBase)) {
|
|
26638
26638
|
try {
|
|
26639
|
-
const { readdirSync:
|
|
26640
|
-
for (const ver of
|
|
26639
|
+
const { readdirSync: readdirSync18 } = await import("node:fs");
|
|
26640
|
+
for (const ver of readdirSync18(nvmBase)) {
|
|
26641
26641
|
const tcPath = join42(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
|
|
26642
26642
|
if (existsSync27(join42(tcPath, "dist", "index.js"))) {
|
|
26643
26643
|
const { createRequire: createRequire4 } = await import("node:module");
|
|
@@ -34926,26 +34926,26 @@ async function fetchOpenAIModels(baseUrl, apiKey) {
|
|
|
34926
34926
|
async function fetchPeerModels(peerId, authKey) {
|
|
34927
34927
|
try {
|
|
34928
34928
|
const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
|
|
34929
|
-
const { existsSync:
|
|
34930
|
-
const { join:
|
|
34929
|
+
const { existsSync: existsSync46, readFileSync: readFileSync34 } = await import("node:fs");
|
|
34930
|
+
const { join: join65 } = await import("node:path");
|
|
34931
34931
|
const cwd4 = process.cwd();
|
|
34932
34932
|
const nexusTool = new NexusTool2(cwd4);
|
|
34933
34933
|
const nexusDir = nexusTool.getNexusDir();
|
|
34934
34934
|
let isLocalPeer = false;
|
|
34935
34935
|
try {
|
|
34936
|
-
const statusPath =
|
|
34937
|
-
if (
|
|
34938
|
-
const status = JSON.parse(
|
|
34936
|
+
const statusPath = join65(nexusDir, "status.json");
|
|
34937
|
+
if (existsSync46(statusPath)) {
|
|
34938
|
+
const status = JSON.parse(readFileSync34(statusPath, "utf8"));
|
|
34939
34939
|
if (status.peerId === peerId)
|
|
34940
34940
|
isLocalPeer = true;
|
|
34941
34941
|
}
|
|
34942
34942
|
} catch {
|
|
34943
34943
|
}
|
|
34944
34944
|
if (isLocalPeer) {
|
|
34945
|
-
const pricingPath =
|
|
34946
|
-
if (
|
|
34945
|
+
const pricingPath = join65(nexusDir, "pricing.json");
|
|
34946
|
+
if (existsSync46(pricingPath)) {
|
|
34947
34947
|
try {
|
|
34948
|
-
const pricing = JSON.parse(
|
|
34948
|
+
const pricing = JSON.parse(readFileSync34(pricingPath, "utf8"));
|
|
34949
34949
|
const localModels = (pricing.models || []).map((m) => ({
|
|
34950
34950
|
name: m.model || "unknown",
|
|
34951
34951
|
size: m.parameterSize || "",
|
|
@@ -34959,10 +34959,10 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
34959
34959
|
}
|
|
34960
34960
|
}
|
|
34961
34961
|
}
|
|
34962
|
-
const cachePath =
|
|
34963
|
-
if (
|
|
34962
|
+
const cachePath = join65(nexusDir, "peer-models-cache.json");
|
|
34963
|
+
if (existsSync46(cachePath)) {
|
|
34964
34964
|
try {
|
|
34965
|
-
const cache4 = JSON.parse(
|
|
34965
|
+
const cache4 = JSON.parse(readFileSync34(cachePath, "utf8"));
|
|
34966
34966
|
if (cache4.peerId === peerId && cache4.models?.length > 0) {
|
|
34967
34967
|
const age = Date.now() - new Date(cache4.cachedAt).getTime();
|
|
34968
34968
|
if (age < 5 * 60 * 1e3) {
|
|
@@ -35077,10 +35077,10 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
35077
35077
|
} catch {
|
|
35078
35078
|
}
|
|
35079
35079
|
if (isLocalPeer) {
|
|
35080
|
-
const pricingPath =
|
|
35081
|
-
if (
|
|
35080
|
+
const pricingPath = join65(nexusDir, "pricing.json");
|
|
35081
|
+
if (existsSync46(pricingPath)) {
|
|
35082
35082
|
try {
|
|
35083
|
-
const pricing = JSON.parse(
|
|
35083
|
+
const pricing = JSON.parse(readFileSync34(pricingPath, "utf8"));
|
|
35084
35084
|
return (pricing.models || []).map((m) => ({
|
|
35085
35085
|
name: m.model || "unknown",
|
|
35086
35086
|
size: m.parameterSize || "",
|
|
@@ -35512,6 +35512,34 @@ var init_dist6 = __esm({
|
|
|
35512
35512
|
});
|
|
35513
35513
|
|
|
35514
35514
|
// packages/cli/dist/tui/oa-directory.js
|
|
35515
|
+
var oa_directory_exports = {};
|
|
35516
|
+
__export(oa_directory_exports, {
|
|
35517
|
+
OA_DIR: () => OA_DIR,
|
|
35518
|
+
buildContextRestorePrompt: () => buildContextRestorePrompt,
|
|
35519
|
+
deleteUsageRecord: () => deleteUsageRecord,
|
|
35520
|
+
discoverContextFiles: () => discoverContextFiles,
|
|
35521
|
+
generateProjectMap: () => generateProjectMap,
|
|
35522
|
+
getLastTaskSummary: () => getLastTaskSummary,
|
|
35523
|
+
hasOaDirectory: () => hasOaDirectory,
|
|
35524
|
+
initOaDirectory: () => initOaDirectory,
|
|
35525
|
+
loadGlobalSettings: () => loadGlobalSettings,
|
|
35526
|
+
loadPendingTask: () => loadPendingTask,
|
|
35527
|
+
loadProjectSettings: () => loadProjectSettings,
|
|
35528
|
+
loadRecentSessions: () => loadRecentSessions,
|
|
35529
|
+
loadSessionContext: () => loadSessionContext,
|
|
35530
|
+
loadUsageHistory: () => loadUsageHistory,
|
|
35531
|
+
readIndexData: () => readIndexData,
|
|
35532
|
+
readIndexMeta: () => readIndexMeta,
|
|
35533
|
+
recordUsage: () => recordUsage,
|
|
35534
|
+
resolveSettings: () => resolveSettings,
|
|
35535
|
+
saveGlobalSettings: () => saveGlobalSettings,
|
|
35536
|
+
savePendingTask: () => savePendingTask,
|
|
35537
|
+
saveProjectSettings: () => saveProjectSettings,
|
|
35538
|
+
saveSession: () => saveSession,
|
|
35539
|
+
saveSessionContext: () => saveSessionContext,
|
|
35540
|
+
writeIndexData: () => writeIndexData,
|
|
35541
|
+
writeIndexMeta: () => writeIndexMeta
|
|
35542
|
+
});
|
|
35515
35543
|
import { existsSync as existsSync31, mkdirSync as mkdirSync11, readFileSync as readFileSync22, writeFileSync as writeFileSync12, readdirSync as readdirSync8, statSync as statSync11, unlinkSync as unlinkSync6 } from "node:fs";
|
|
35516
35544
|
import { join as join47, relative as relative2, basename as basename9, extname as extname8 } from "node:path";
|
|
35517
35545
|
import { homedir as homedir9 } from "node:os";
|
|
@@ -35643,6 +35671,24 @@ function readIndexMeta(repoRoot) {
|
|
|
35643
35671
|
return null;
|
|
35644
35672
|
}
|
|
35645
35673
|
}
|
|
35674
|
+
function writeIndexMeta(repoRoot, meta) {
|
|
35675
|
+
const metaPath = join47(repoRoot, OA_DIR, "index", "meta.json");
|
|
35676
|
+
mkdirSync11(join47(repoRoot, OA_DIR, "index"), { recursive: true });
|
|
35677
|
+
writeFileSync12(metaPath, JSON.stringify(meta, null, 2), "utf-8");
|
|
35678
|
+
}
|
|
35679
|
+
function readIndexData(repoRoot, filename) {
|
|
35680
|
+
const filePath = join47(repoRoot, OA_DIR, "index", filename);
|
|
35681
|
+
try {
|
|
35682
|
+
return JSON.parse(readFileSync22(filePath, "utf-8"));
|
|
35683
|
+
} catch {
|
|
35684
|
+
return null;
|
|
35685
|
+
}
|
|
35686
|
+
}
|
|
35687
|
+
function writeIndexData(repoRoot, filename, data) {
|
|
35688
|
+
const filePath = join47(repoRoot, OA_DIR, "index", filename);
|
|
35689
|
+
mkdirSync11(join47(repoRoot, OA_DIR, "index"), { recursive: true });
|
|
35690
|
+
writeFileSync12(filePath, JSON.stringify(data, null, 2), "utf-8");
|
|
35691
|
+
}
|
|
35646
35692
|
function generateProjectMap(repoRoot) {
|
|
35647
35693
|
const sections = [];
|
|
35648
35694
|
const repoName2 = basename9(repoRoot);
|
|
@@ -35774,25 +35820,24 @@ function buildContextRestorePrompt(repoRoot) {
|
|
|
35774
35820
|
const ctx = loadSessionContext(repoRoot);
|
|
35775
35821
|
if (!ctx || ctx.entries.length === 0)
|
|
35776
35822
|
return null;
|
|
35777
|
-
const
|
|
35778
|
-
|
|
35779
|
-
""
|
|
35780
|
-
|
|
35781
|
-
|
|
35782
|
-
|
|
35783
|
-
|
|
35784
|
-
|
|
35785
|
-
|
|
35786
|
-
|
|
35787
|
-
|
|
35788
|
-
|
|
35789
|
-
|
|
35790
|
-
|
|
35791
|
-
|
|
35792
|
-
|
|
35793
|
-
|
|
35794
|
-
|
|
35795
|
-
return lines.join("\n");
|
|
35823
|
+
const recent = ctx.entries.slice(-5);
|
|
35824
|
+
const lines = recent.map((e) => {
|
|
35825
|
+
const status = e.completed ? "done" : "partial";
|
|
35826
|
+
const summary = e.summary ? e.summary.slice(0, 100) : e.task.slice(0, 100);
|
|
35827
|
+
return `[${status}] ${summary}`;
|
|
35828
|
+
});
|
|
35829
|
+
return `Previous work in this project:
|
|
35830
|
+
${lines.join("\n")}
|
|
35831
|
+
Do not repeat completed work.`;
|
|
35832
|
+
}
|
|
35833
|
+
function getLastTaskSummary(repoRoot) {
|
|
35834
|
+
const ctx = loadSessionContext(repoRoot);
|
|
35835
|
+
if (!ctx || ctx.entries.length === 0)
|
|
35836
|
+
return null;
|
|
35837
|
+
const last = ctx.entries[ctx.entries.length - 1];
|
|
35838
|
+
const text = last.summary || last.task;
|
|
35839
|
+
const clean = text.replace(/^\[.*?\]\s*/, "").replace(/\s+/g, " ").trim();
|
|
35840
|
+
return clean.length > 40 ? clean.slice(0, 37) + "..." : clean;
|
|
35796
35841
|
}
|
|
35797
35842
|
function detectManifests(repoRoot) {
|
|
35798
35843
|
const manifests = [];
|
|
@@ -41651,6 +41696,8 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
|
41651
41696
|
// packages/cli/dist/tui/commands.js
|
|
41652
41697
|
import * as nodeOs from "node:os";
|
|
41653
41698
|
import { execSync as nodeExecSync } from "node:child_process";
|
|
41699
|
+
import { existsSync as existsSync36, readFileSync as readFileSync25, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, readdirSync as readdirSync10, statSync as statSync13, rmSync } from "node:fs";
|
|
41700
|
+
import { join as join51 } from "node:path";
|
|
41654
41701
|
function safeLog(text) {
|
|
41655
41702
|
if (isNeovimActive()) {
|
|
41656
41703
|
writeToNeovimOutput(text + "\n");
|
|
@@ -42076,6 +42123,194 @@ async function handleSlashCommand(input, ctx) {
|
|
|
42076
42123
|
safeLog(lines.join("\n"));
|
|
42077
42124
|
return "handled";
|
|
42078
42125
|
}
|
|
42126
|
+
case "ipfs": {
|
|
42127
|
+
const lines = [];
|
|
42128
|
+
lines.push(`
|
|
42129
|
+
${c2.bold("IPFS / Helia Status")}
|
|
42130
|
+
`);
|
|
42131
|
+
const ipfsDir = join51(ctx.repoRoot, ".oa", "ipfs");
|
|
42132
|
+
const ipfsLocalDir = join51(ipfsDir, "local");
|
|
42133
|
+
let ipfsFiles = 0;
|
|
42134
|
+
let ipfsBytes = 0;
|
|
42135
|
+
let heliaBlocks = 0;
|
|
42136
|
+
let heliaBytes = 0;
|
|
42137
|
+
try {
|
|
42138
|
+
if (existsSync36(ipfsLocalDir)) {
|
|
42139
|
+
const files = readdirSync10(ipfsLocalDir).filter((f) => f.endsWith(".json"));
|
|
42140
|
+
ipfsFiles = files.length;
|
|
42141
|
+
for (const f of files) {
|
|
42142
|
+
try {
|
|
42143
|
+
ipfsBytes += statSync13(join51(ipfsLocalDir, f)).size;
|
|
42144
|
+
} catch {
|
|
42145
|
+
}
|
|
42146
|
+
}
|
|
42147
|
+
}
|
|
42148
|
+
const heliaBlockDir = join51(ipfsDir, "blocks");
|
|
42149
|
+
if (existsSync36(heliaBlockDir)) {
|
|
42150
|
+
const walkDir = (dir) => {
|
|
42151
|
+
for (const entry of readdirSync10(dir, { withFileTypes: true })) {
|
|
42152
|
+
if (entry.isDirectory())
|
|
42153
|
+
walkDir(join51(dir, entry.name));
|
|
42154
|
+
else {
|
|
42155
|
+
heliaBlocks++;
|
|
42156
|
+
try {
|
|
42157
|
+
heliaBytes += statSync13(join51(dir, entry.name)).size;
|
|
42158
|
+
} catch {
|
|
42159
|
+
}
|
|
42160
|
+
}
|
|
42161
|
+
}
|
|
42162
|
+
};
|
|
42163
|
+
walkDir(heliaBlockDir);
|
|
42164
|
+
}
|
|
42165
|
+
} catch {
|
|
42166
|
+
}
|
|
42167
|
+
lines.push(` ${c2.dim("Local fallback (SHA-256):")}`);
|
|
42168
|
+
lines.push(` Files: ${c2.bold(String(ipfsFiles))} Size: ${c2.bold(formatFileSize(ipfsBytes))}`);
|
|
42169
|
+
lines.push(` ${c2.dim("Helia blocks:")}`);
|
|
42170
|
+
lines.push(` Blocks: ${c2.bold(String(heliaBlocks))} Size: ${c2.bold(formatFileSize(heliaBytes))}`);
|
|
42171
|
+
lines.push(` Backend: ${heliaBlocks > 0 ? c2.green("helia-ipfs") : c2.yellow("sha256-local (Helia not initialized)")}`);
|
|
42172
|
+
lines.push(`
|
|
42173
|
+
${c2.bold("Identity Kernel")}`);
|
|
42174
|
+
const idDir = join51(ctx.repoRoot, ".oa", "identity");
|
|
42175
|
+
try {
|
|
42176
|
+
const stateFile = join51(idDir, "self-state.json");
|
|
42177
|
+
if (existsSync36(stateFile)) {
|
|
42178
|
+
const state = JSON.parse(readFileSync25(stateFile, "utf8"));
|
|
42179
|
+
lines.push(` Version: ${c2.bold("v" + (state.version ?? "?"))} Sessions: ${c2.bold(String(state.session_count ?? 0))}`);
|
|
42180
|
+
if (state.narrative_summary) {
|
|
42181
|
+
lines.push(` Narrative: ${c2.dim(state.narrative_summary.slice(0, 60))}${state.narrative_summary.length > 60 ? "..." : ""}`);
|
|
42182
|
+
}
|
|
42183
|
+
if (state.personality_traits) {
|
|
42184
|
+
const traits = typeof state.personality_traits === "object" ? Object.entries(state.personality_traits).map(([k, v]) => `${k}:${v}`).join(", ") : String(state.personality_traits);
|
|
42185
|
+
lines.push(` Traits: ${c2.dim(traits.slice(0, 60))}`);
|
|
42186
|
+
}
|
|
42187
|
+
const cidFile = join51(idDir, "cids.json");
|
|
42188
|
+
if (existsSync36(cidFile)) {
|
|
42189
|
+
const cids = JSON.parse(readFileSync25(cidFile, "utf8"));
|
|
42190
|
+
const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
|
|
42191
|
+
if (lastCid)
|
|
42192
|
+
lines.push(` Last CID: ${c2.dim(String(lastCid).slice(0, 50))}`);
|
|
42193
|
+
}
|
|
42194
|
+
} else {
|
|
42195
|
+
lines.push(` ${c2.dim("Not initialized (run 5+ tasks to generate)")}`);
|
|
42196
|
+
}
|
|
42197
|
+
} catch {
|
|
42198
|
+
}
|
|
42199
|
+
lines.push(`
|
|
42200
|
+
${c2.bold("Memory Sentiment")}`);
|
|
42201
|
+
try {
|
|
42202
|
+
const metaFile = join51(ctx.repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
42203
|
+
if (existsSync36(metaFile)) {
|
|
42204
|
+
const store = JSON.parse(readFileSync25(metaFile, "utf8"));
|
|
42205
|
+
const active = store.filter((m) => m.type !== "quarantine");
|
|
42206
|
+
const recoveries = active.filter((m) => m.content?.startsWith("[recovery]")).length;
|
|
42207
|
+
const strategies = active.filter((m) => m.content?.startsWith("[strategy]")).length;
|
|
42208
|
+
const optimizations = active.filter((m) => m.content?.startsWith("[optimization]")).length;
|
|
42209
|
+
const avgUtil = active.length > 0 ? active.reduce((s, m) => s + (m.scores?.utility ?? 0), 0) / active.length : 0;
|
|
42210
|
+
const avgConf = active.length > 0 ? active.reduce((s, m) => s + (m.scores?.confidence ?? 0), 0) / active.length : 0;
|
|
42211
|
+
lines.push(` Memories: ${c2.bold(String(active.length))} (${recoveries} recovery, ${strategies} strategy, ${optimizations} optimization)`);
|
|
42212
|
+
lines.push(` Avg utility: ${c2.bold(avgUtil.toFixed(2))} Avg confidence: ${c2.bold(avgConf.toFixed(2))}`);
|
|
42213
|
+
const sentiment = strategies + optimizations > recoveries ? "proactive" : recoveries > 0 ? "defensive" : "neutral";
|
|
42214
|
+
const sentimentColor = sentiment === "proactive" ? c2.green : sentiment === "defensive" ? c2.yellow : c2.dim;
|
|
42215
|
+
lines.push(` Overall: ${sentimentColor(sentiment)} (${strategies + optimizations} proactive / ${recoveries} defensive)`);
|
|
42216
|
+
} else {
|
|
42217
|
+
lines.push(` ${c2.dim("No memories yet (complete tasks to learn)")}`);
|
|
42218
|
+
}
|
|
42219
|
+
} catch {
|
|
42220
|
+
}
|
|
42221
|
+
try {
|
|
42222
|
+
const dbPath = join51(ctx.repoRoot, ".oa", "memory", "structured.db");
|
|
42223
|
+
if (existsSync36(dbPath)) {
|
|
42224
|
+
const { initDb: initDb2, closeDb: cDb, ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
|
|
42225
|
+
const db = initDb2(dbPath);
|
|
42226
|
+
const memStore = new ProceduralMemoryStore2(db);
|
|
42227
|
+
const count = memStore.count();
|
|
42228
|
+
lines.push(`
|
|
42229
|
+
${c2.bold("Structured Memory (SQLite)")}`);
|
|
42230
|
+
lines.push(` Memories: ${c2.bold(String(count))} DB: ${c2.dim(formatFileSize(statSync13(dbPath).size))}`);
|
|
42231
|
+
cDb(db);
|
|
42232
|
+
}
|
|
42233
|
+
} catch {
|
|
42234
|
+
}
|
|
42235
|
+
lines.push("");
|
|
42236
|
+
safeLog(lines.join("\n"));
|
|
42237
|
+
return "handled";
|
|
42238
|
+
}
|
|
42239
|
+
case "storage": {
|
|
42240
|
+
const lines = [];
|
|
42241
|
+
lines.push(`
|
|
42242
|
+
${c2.bold("Storage Overview")}
|
|
42243
|
+
`);
|
|
42244
|
+
const oaDir = join51(ctx.repoRoot, ".oa");
|
|
42245
|
+
if (!existsSync36(oaDir)) {
|
|
42246
|
+
lines.push(` ${c2.dim("No .oa/ directory found.")}`);
|
|
42247
|
+
safeLog(lines.join("\n") + "\n");
|
|
42248
|
+
return "handled";
|
|
42249
|
+
}
|
|
42250
|
+
let totalBytes = 0;
|
|
42251
|
+
const categories = {};
|
|
42252
|
+
const walkStorage = (dir, category) => {
|
|
42253
|
+
try {
|
|
42254
|
+
for (const entry of readdirSync10(dir, { withFileTypes: true })) {
|
|
42255
|
+
const full = join51(dir, entry.name);
|
|
42256
|
+
if (entry.isDirectory()) {
|
|
42257
|
+
const subCat = category || entry.name;
|
|
42258
|
+
walkStorage(full, subCat);
|
|
42259
|
+
} else {
|
|
42260
|
+
try {
|
|
42261
|
+
const sz = statSync13(full).size;
|
|
42262
|
+
totalBytes += sz;
|
|
42263
|
+
if (!categories[category])
|
|
42264
|
+
categories[category] = { files: 0, bytes: 0 };
|
|
42265
|
+
categories[category].files++;
|
|
42266
|
+
categories[category].bytes += sz;
|
|
42267
|
+
} catch {
|
|
42268
|
+
}
|
|
42269
|
+
}
|
|
42270
|
+
}
|
|
42271
|
+
} catch {
|
|
42272
|
+
}
|
|
42273
|
+
};
|
|
42274
|
+
walkStorage(oaDir, "");
|
|
42275
|
+
const sorted = Object.entries(categories).sort((a, b) => b[1].bytes - a[1].bytes);
|
|
42276
|
+
for (const [cat, info] of sorted) {
|
|
42277
|
+
const name = cat || "root";
|
|
42278
|
+
const pct = totalBytes > 0 ? Math.round(info.bytes / totalBytes * 100) : 0;
|
|
42279
|
+
const bar = "\u2588".repeat(Math.max(1, Math.round(pct / 5))) + "\u2591".repeat(Math.max(0, 20 - Math.round(pct / 5)));
|
|
42280
|
+
lines.push(` ${c2.bold(name.padEnd(20))} ${bar} ${formatFileSize(info.bytes).padStart(8)} ${String(info.files).padStart(4)} files ${String(pct).padStart(2)}%`);
|
|
42281
|
+
}
|
|
42282
|
+
lines.push(`
|
|
42283
|
+
${c2.bold("Total:")} ${c2.bold(formatFileSize(totalBytes))} across ${sorted.reduce((s, [, v]) => s + v.files, 0)} files`);
|
|
42284
|
+
const sensitivePatterns = [".env", "credentials", "secret", "private_key", "token.json"];
|
|
42285
|
+
const sensitiveFound = [];
|
|
42286
|
+
const checkSensitive = (dir) => {
|
|
42287
|
+
try {
|
|
42288
|
+
for (const entry of readdirSync10(dir, { withFileTypes: true })) {
|
|
42289
|
+
const name = entry.name.toLowerCase();
|
|
42290
|
+
if (sensitivePatterns.some((p) => name.includes(p))) {
|
|
42291
|
+
sensitiveFound.push(join51(dir, entry.name).replace(oaDir + "/", ""));
|
|
42292
|
+
}
|
|
42293
|
+
if (entry.isDirectory())
|
|
42294
|
+
checkSensitive(join51(dir, entry.name));
|
|
42295
|
+
}
|
|
42296
|
+
} catch {
|
|
42297
|
+
}
|
|
42298
|
+
};
|
|
42299
|
+
checkSensitive(oaDir);
|
|
42300
|
+
if (sensitiveFound.length > 0) {
|
|
42301
|
+
lines.push(`
|
|
42302
|
+
${c2.yellow("\u26A0")} ${c2.bold("Sensitive files detected (excluded from IPFS/COHERE):")}`);
|
|
42303
|
+
for (const f of sensitiveFound.slice(0, 5)) {
|
|
42304
|
+
lines.push(` ${c2.yellow(f)}`);
|
|
42305
|
+
}
|
|
42306
|
+
} else {
|
|
42307
|
+
lines.push(`
|
|
42308
|
+
${c2.green("\u2713")} No sensitive files detected in .oa/ storage`);
|
|
42309
|
+
}
|
|
42310
|
+
lines.push("");
|
|
42311
|
+
safeLog(lines.join("\n"));
|
|
42312
|
+
return "handled";
|
|
42313
|
+
}
|
|
42079
42314
|
case "model":
|
|
42080
42315
|
if (arg) {
|
|
42081
42316
|
await switchModel(arg, ctx, hasLocal);
|
|
@@ -43529,12 +43764,12 @@ async function handleVoiceMenu(ctx, save, hasLocal) {
|
|
|
43529
43764
|
continue;
|
|
43530
43765
|
}
|
|
43531
43766
|
const { basename: basename16, join: pathJoin } = await import("node:path");
|
|
43532
|
-
const { copyFileSync: copyFileSync2, mkdirSync:
|
|
43767
|
+
const { copyFileSync: copyFileSync2, mkdirSync: mkdirSync22, existsSync: exists } = await import("node:fs");
|
|
43533
43768
|
const { homedir: homedir15 } = await import("node:os");
|
|
43534
43769
|
const modelName = basename16(onnxDrop.path, ".onnx").replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
43535
43770
|
const destDir = pathJoin(homedir15(), ".open-agents", "voice", "models", modelName);
|
|
43536
43771
|
if (!exists(destDir))
|
|
43537
|
-
|
|
43772
|
+
mkdirSync22(destDir, { recursive: true });
|
|
43538
43773
|
copyFileSync2(onnxDrop.path, pathJoin(destDir, "model.onnx"));
|
|
43539
43774
|
copyFileSync2(jsonDrop.path, pathJoin(destDir, "config.json"));
|
|
43540
43775
|
const { registerCustomOnnxModel: registerCustomOnnxModel2 } = await Promise.resolve().then(() => (init_voice(), voice_exports));
|
|
@@ -44026,11 +44261,11 @@ async function handlePeerEndpoint(peerId, authKey, ctx, local) {
|
|
|
44026
44261
|
const models = await fetchModels(peerUrl, authKey);
|
|
44027
44262
|
if (models.length > 0) {
|
|
44028
44263
|
try {
|
|
44029
|
-
const { writeFileSync:
|
|
44030
|
-
const { join:
|
|
44031
|
-
const cachePath =
|
|
44032
|
-
|
|
44033
|
-
|
|
44264
|
+
const { writeFileSync: writeFileSync21, mkdirSync: mkdirSync22 } = await import("node:fs");
|
|
44265
|
+
const { join: join65, dirname: dirname21 } = await import("node:path");
|
|
44266
|
+
const cachePath = join65(ctx.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
|
|
44267
|
+
mkdirSync22(dirname21(cachePath), { recursive: true });
|
|
44268
|
+
writeFileSync21(cachePath, JSON.stringify({
|
|
44034
44269
|
peerId,
|
|
44035
44270
|
cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
44036
44271
|
models: models.map((m) => ({ name: m.name, size: m.size, parameterSize: m.parameterSize }))
|
|
@@ -44229,17 +44464,17 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
44229
44464
|
try {
|
|
44230
44465
|
const { createRequire: createRequire4 } = await import("node:module");
|
|
44231
44466
|
const { fileURLToPath: fileURLToPath14 } = await import("node:url");
|
|
44232
|
-
const { dirname: dirname21, join:
|
|
44233
|
-
const { existsSync:
|
|
44467
|
+
const { dirname: dirname21, join: join65 } = await import("node:path");
|
|
44468
|
+
const { existsSync: existsSync46 } = await import("node:fs");
|
|
44234
44469
|
const req = createRequire4(import.meta.url);
|
|
44235
44470
|
const thisDir = dirname21(fileURLToPath14(import.meta.url));
|
|
44236
44471
|
const candidates = [
|
|
44237
|
-
|
|
44238
|
-
|
|
44239
|
-
|
|
44472
|
+
join65(thisDir, "..", "package.json"),
|
|
44473
|
+
join65(thisDir, "..", "..", "package.json"),
|
|
44474
|
+
join65(thisDir, "..", "..", "..", "package.json")
|
|
44240
44475
|
];
|
|
44241
44476
|
for (const pkgPath of candidates) {
|
|
44242
|
-
if (
|
|
44477
|
+
if (existsSync46(pkgPath)) {
|
|
44243
44478
|
const pkg = req(pkgPath);
|
|
44244
44479
|
if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
|
|
44245
44480
|
currentVersion = pkg.version ?? "0.0.0";
|
|
@@ -45076,8 +45311,8 @@ var init_commands = __esm({
|
|
|
45076
45311
|
});
|
|
45077
45312
|
|
|
45078
45313
|
// packages/cli/dist/tui/project-context.js
|
|
45079
|
-
import { existsSync as
|
|
45080
|
-
import { join as
|
|
45314
|
+
import { existsSync as existsSync37, readFileSync as readFileSync26, readdirSync as readdirSync11 } from "node:fs";
|
|
45315
|
+
import { join as join52, basename as basename10 } from "node:path";
|
|
45081
45316
|
import { execSync as execSync27 } from "node:child_process";
|
|
45082
45317
|
import { homedir as homedir12, platform as platform3, release } from "node:os";
|
|
45083
45318
|
function getModelTier(modelName) {
|
|
@@ -45112,10 +45347,10 @@ function loadProjectMap(repoRoot) {
|
|
|
45112
45347
|
if (!hasOaDirectory(repoRoot)) {
|
|
45113
45348
|
initOaDirectory(repoRoot);
|
|
45114
45349
|
}
|
|
45115
|
-
const mapPath =
|
|
45116
|
-
if (
|
|
45350
|
+
const mapPath = join52(repoRoot, OA_DIR, "context", "project-map.md");
|
|
45351
|
+
if (existsSync37(mapPath)) {
|
|
45117
45352
|
try {
|
|
45118
|
-
const content =
|
|
45353
|
+
const content = readFileSync26(mapPath, "utf-8");
|
|
45119
45354
|
return content;
|
|
45120
45355
|
} catch {
|
|
45121
45356
|
}
|
|
@@ -45156,31 +45391,31 @@ ${log}`);
|
|
|
45156
45391
|
}
|
|
45157
45392
|
function loadMemoryContext(repoRoot) {
|
|
45158
45393
|
const sections = [];
|
|
45159
|
-
const oaMemDir =
|
|
45394
|
+
const oaMemDir = join52(repoRoot, OA_DIR, "memory");
|
|
45160
45395
|
const oaEntries = loadMemoryDir(oaMemDir, "project");
|
|
45161
45396
|
if (oaEntries)
|
|
45162
45397
|
sections.push(oaEntries);
|
|
45163
|
-
const legacyMemDir =
|
|
45164
|
-
if (legacyMemDir !== oaMemDir &&
|
|
45398
|
+
const legacyMemDir = join52(repoRoot, ".open-agents", "memory");
|
|
45399
|
+
if (legacyMemDir !== oaMemDir && existsSync37(legacyMemDir)) {
|
|
45165
45400
|
const legacyEntries = loadMemoryDir(legacyMemDir, "project/legacy");
|
|
45166
45401
|
if (legacyEntries)
|
|
45167
45402
|
sections.push(legacyEntries);
|
|
45168
45403
|
}
|
|
45169
|
-
const globalMemDir =
|
|
45404
|
+
const globalMemDir = join52(homedir12(), ".open-agents", "memory");
|
|
45170
45405
|
const globalEntries = loadMemoryDir(globalMemDir, "global");
|
|
45171
45406
|
if (globalEntries)
|
|
45172
45407
|
sections.push(globalEntries);
|
|
45173
45408
|
return sections.join("\n\n");
|
|
45174
45409
|
}
|
|
45175
45410
|
function loadMemoryDir(memDir, scope) {
|
|
45176
|
-
if (!
|
|
45411
|
+
if (!existsSync37(memDir))
|
|
45177
45412
|
return "";
|
|
45178
45413
|
const lines = [];
|
|
45179
45414
|
try {
|
|
45180
|
-
const files =
|
|
45415
|
+
const files = readdirSync11(memDir).filter((f) => f.endsWith(".json"));
|
|
45181
45416
|
for (const file of files.slice(0, 10)) {
|
|
45182
45417
|
try {
|
|
45183
|
-
const raw =
|
|
45418
|
+
const raw = readFileSync26(join52(memDir, file), "utf-8");
|
|
45184
45419
|
const entries = JSON.parse(raw);
|
|
45185
45420
|
const topic = basename10(file, ".json");
|
|
45186
45421
|
const keys = Object.keys(entries);
|
|
@@ -46699,22 +46934,22 @@ var init_banner = __esm({
|
|
|
46699
46934
|
});
|
|
46700
46935
|
|
|
46701
46936
|
// packages/cli/dist/tui/carousel-descriptors.js
|
|
46702
|
-
import { existsSync as
|
|
46703
|
-
import { join as
|
|
46937
|
+
import { existsSync as existsSync38, readFileSync as readFileSync27, writeFileSync as writeFileSync16, mkdirSync as mkdirSync15, readdirSync as readdirSync12 } from "node:fs";
|
|
46938
|
+
import { join as join53, basename as basename11 } from "node:path";
|
|
46704
46939
|
function loadToolProfile(repoRoot) {
|
|
46705
|
-
const filePath =
|
|
46940
|
+
const filePath = join53(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
|
|
46706
46941
|
try {
|
|
46707
|
-
if (!
|
|
46942
|
+
if (!existsSync38(filePath))
|
|
46708
46943
|
return null;
|
|
46709
|
-
return JSON.parse(
|
|
46944
|
+
return JSON.parse(readFileSync27(filePath, "utf-8"));
|
|
46710
46945
|
} catch {
|
|
46711
46946
|
return null;
|
|
46712
46947
|
}
|
|
46713
46948
|
}
|
|
46714
46949
|
function saveToolProfile(repoRoot, profile) {
|
|
46715
|
-
const contextDir =
|
|
46716
|
-
|
|
46717
|
-
|
|
46950
|
+
const contextDir = join53(repoRoot, OA_DIR, "context");
|
|
46951
|
+
mkdirSync15(contextDir, { recursive: true });
|
|
46952
|
+
writeFileSync16(join53(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
|
|
46718
46953
|
}
|
|
46719
46954
|
function categorizeToolCall(toolName) {
|
|
46720
46955
|
for (const cat of TOOL_CATEGORIES) {
|
|
@@ -46772,25 +47007,25 @@ function weightedColor(profile) {
|
|
|
46772
47007
|
return selectedCat.colors[Math.floor(Math.random() * selectedCat.colors.length)];
|
|
46773
47008
|
}
|
|
46774
47009
|
function loadCachedDescriptors(repoRoot) {
|
|
46775
|
-
const filePath =
|
|
47010
|
+
const filePath = join53(repoRoot, OA_DIR, "context", DESCRIPTOR_FILE);
|
|
46776
47011
|
try {
|
|
46777
|
-
if (!
|
|
47012
|
+
if (!existsSync38(filePath))
|
|
46778
47013
|
return null;
|
|
46779
|
-
const cached = JSON.parse(
|
|
47014
|
+
const cached = JSON.parse(readFileSync27(filePath, "utf-8"));
|
|
46780
47015
|
return cached.phrases.length > 0 ? cached.phrases : null;
|
|
46781
47016
|
} catch {
|
|
46782
47017
|
return null;
|
|
46783
47018
|
}
|
|
46784
47019
|
}
|
|
46785
47020
|
function saveCachedDescriptors(repoRoot, phrases, sourceHash) {
|
|
46786
|
-
const contextDir =
|
|
46787
|
-
|
|
47021
|
+
const contextDir = join53(repoRoot, OA_DIR, "context");
|
|
47022
|
+
mkdirSync15(contextDir, { recursive: true });
|
|
46788
47023
|
const cached = {
|
|
46789
47024
|
phrases,
|
|
46790
47025
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
46791
47026
|
sourceHash
|
|
46792
47027
|
};
|
|
46793
|
-
|
|
47028
|
+
writeFileSync16(join53(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
|
|
46794
47029
|
}
|
|
46795
47030
|
function generateDescriptors(repoRoot) {
|
|
46796
47031
|
const profile = loadToolProfile(repoRoot);
|
|
@@ -46838,11 +47073,11 @@ function generateDescriptors(repoRoot) {
|
|
|
46838
47073
|
return phrases;
|
|
46839
47074
|
}
|
|
46840
47075
|
function extractFromPackageJson(repoRoot, tags) {
|
|
46841
|
-
const pkgPath =
|
|
47076
|
+
const pkgPath = join53(repoRoot, "package.json");
|
|
46842
47077
|
try {
|
|
46843
|
-
if (!
|
|
47078
|
+
if (!existsSync38(pkgPath))
|
|
46844
47079
|
return;
|
|
46845
|
-
const pkg = JSON.parse(
|
|
47080
|
+
const pkg = JSON.parse(readFileSync27(pkgPath, "utf-8"));
|
|
46846
47081
|
if (pkg.name && typeof pkg.name === "string") {
|
|
46847
47082
|
const parts = pkg.name.replace(/^@/, "").split("/");
|
|
46848
47083
|
for (const p of parts)
|
|
@@ -46886,7 +47121,7 @@ function extractFromManifests(repoRoot, tags) {
|
|
|
46886
47121
|
{ file: ".github/workflows", tag: "ci/cd" }
|
|
46887
47122
|
];
|
|
46888
47123
|
for (const check of manifestChecks) {
|
|
46889
|
-
if (
|
|
47124
|
+
if (existsSync38(join53(repoRoot, check.file))) {
|
|
46890
47125
|
tags.push(check.tag);
|
|
46891
47126
|
}
|
|
46892
47127
|
}
|
|
@@ -46908,16 +47143,16 @@ function extractFromSessions(repoRoot, tags) {
|
|
|
46908
47143
|
}
|
|
46909
47144
|
}
|
|
46910
47145
|
function extractFromMemory(repoRoot, tags) {
|
|
46911
|
-
const memoryDir =
|
|
47146
|
+
const memoryDir = join53(repoRoot, OA_DIR, "memory");
|
|
46912
47147
|
try {
|
|
46913
|
-
if (!
|
|
47148
|
+
if (!existsSync38(memoryDir))
|
|
46914
47149
|
return;
|
|
46915
|
-
const files =
|
|
47150
|
+
const files = readdirSync12(memoryDir).filter((f) => f.endsWith(".json"));
|
|
46916
47151
|
for (const file of files) {
|
|
46917
47152
|
const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
|
|
46918
47153
|
tags.push(topic);
|
|
46919
47154
|
try {
|
|
46920
|
-
const data = JSON.parse(
|
|
47155
|
+
const data = JSON.parse(readFileSync27(join53(memoryDir, file), "utf-8"));
|
|
46921
47156
|
if (data && typeof data === "object") {
|
|
46922
47157
|
const keys = Object.keys(data).slice(0, 3);
|
|
46923
47158
|
for (const key of keys) {
|
|
@@ -47550,13 +47785,13 @@ var init_stream_renderer = __esm({
|
|
|
47550
47785
|
});
|
|
47551
47786
|
|
|
47552
47787
|
// packages/cli/dist/tui/edit-history.js
|
|
47553
|
-
import { appendFileSync as appendFileSync3, mkdirSync as
|
|
47554
|
-
import { join as
|
|
47788
|
+
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync16 } from "node:fs";
|
|
47789
|
+
import { join as join54 } from "node:path";
|
|
47555
47790
|
function createEditHistoryLogger(repoRoot, sessionId) {
|
|
47556
|
-
const historyDir =
|
|
47557
|
-
const logPath =
|
|
47791
|
+
const historyDir = join54(repoRoot, ".oa", "history");
|
|
47792
|
+
const logPath = join54(historyDir, "edits.jsonl");
|
|
47558
47793
|
try {
|
|
47559
|
-
|
|
47794
|
+
mkdirSync16(historyDir, { recursive: true });
|
|
47560
47795
|
} catch {
|
|
47561
47796
|
}
|
|
47562
47797
|
function logToolCall(toolName, toolArgs, success) {
|
|
@@ -47665,17 +47900,17 @@ var init_edit_history = __esm({
|
|
|
47665
47900
|
});
|
|
47666
47901
|
|
|
47667
47902
|
// packages/cli/dist/tui/promptLoader.js
|
|
47668
|
-
import { readFileSync as
|
|
47669
|
-
import { join as
|
|
47903
|
+
import { readFileSync as readFileSync28, existsSync as existsSync39 } from "node:fs";
|
|
47904
|
+
import { join as join55, dirname as dirname18 } from "node:path";
|
|
47670
47905
|
import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
47671
47906
|
function loadPrompt3(promptPath, vars) {
|
|
47672
47907
|
let content = cache3.get(promptPath);
|
|
47673
47908
|
if (content === void 0) {
|
|
47674
|
-
const fullPath =
|
|
47675
|
-
if (!
|
|
47909
|
+
const fullPath = join55(PROMPTS_DIR3, promptPath);
|
|
47910
|
+
if (!existsSync39(fullPath)) {
|
|
47676
47911
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
47677
47912
|
}
|
|
47678
|
-
content =
|
|
47913
|
+
content = readFileSync28(fullPath, "utf-8");
|
|
47679
47914
|
cache3.set(promptPath, content);
|
|
47680
47915
|
}
|
|
47681
47916
|
if (!vars)
|
|
@@ -47688,23 +47923,23 @@ var init_promptLoader3 = __esm({
|
|
|
47688
47923
|
"use strict";
|
|
47689
47924
|
__filename3 = fileURLToPath11(import.meta.url);
|
|
47690
47925
|
__dirname6 = dirname18(__filename3);
|
|
47691
|
-
devPath2 =
|
|
47692
|
-
publishedPath2 =
|
|
47693
|
-
PROMPTS_DIR3 =
|
|
47926
|
+
devPath2 = join55(__dirname6, "..", "..", "prompts");
|
|
47927
|
+
publishedPath2 = join55(__dirname6, "..", "prompts");
|
|
47928
|
+
PROMPTS_DIR3 = existsSync39(devPath2) ? devPath2 : publishedPath2;
|
|
47694
47929
|
cache3 = /* @__PURE__ */ new Map();
|
|
47695
47930
|
}
|
|
47696
47931
|
});
|
|
47697
47932
|
|
|
47698
47933
|
// packages/cli/dist/tui/dream-engine.js
|
|
47699
|
-
import { mkdirSync as
|
|
47700
|
-
import { join as
|
|
47934
|
+
import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync17, readFileSync as readFileSync29, existsSync as existsSync40, cpSync, rmSync as rmSync2, readdirSync as readdirSync13 } from "node:fs";
|
|
47935
|
+
import { join as join56, basename as basename12 } from "node:path";
|
|
47701
47936
|
import { execSync as execSync28 } from "node:child_process";
|
|
47702
47937
|
function loadAutoresearchMemory(repoRoot) {
|
|
47703
|
-
const memoryPath =
|
|
47704
|
-
if (!
|
|
47938
|
+
const memoryPath = join56(repoRoot, ".oa", "memory", "autoresearch.json");
|
|
47939
|
+
if (!existsSync40(memoryPath))
|
|
47705
47940
|
return "";
|
|
47706
47941
|
try {
|
|
47707
|
-
const raw =
|
|
47942
|
+
const raw = readFileSync29(memoryPath, "utf-8");
|
|
47708
47943
|
const data = JSON.parse(raw);
|
|
47709
47944
|
const sections = [];
|
|
47710
47945
|
for (const key of AUTORESEARCH_MEMORY_KEYS) {
|
|
@@ -47894,14 +48129,14 @@ var init_dream_engine = __esm({
|
|
|
47894
48129
|
const content = String(args["content"] ?? "");
|
|
47895
48130
|
if (!rawPath)
|
|
47896
48131
|
return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
|
|
47897
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ?
|
|
48132
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join56(this.autoresearchDir, basename12(rawPath)) : join56(this.autoresearchDir, rawPath);
|
|
47898
48133
|
if (!targetPath.startsWith(this.autoresearchDir)) {
|
|
47899
48134
|
return { success: false, output: "", error: "Autoresearch mode: writes are confined to .oa/autoresearch/", durationMs: Date.now() - start };
|
|
47900
48135
|
}
|
|
47901
48136
|
try {
|
|
47902
|
-
const dir =
|
|
47903
|
-
|
|
47904
|
-
|
|
48137
|
+
const dir = join56(targetPath, "..");
|
|
48138
|
+
mkdirSync17(dir, { recursive: true });
|
|
48139
|
+
writeFileSync17(targetPath, content, "utf-8");
|
|
47905
48140
|
return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
|
|
47906
48141
|
} catch (err) {
|
|
47907
48142
|
return { success: false, output: "", error: String(err), durationMs: Date.now() - start };
|
|
@@ -47929,20 +48164,20 @@ var init_dream_engine = __esm({
|
|
|
47929
48164
|
const rawPath = String(args["path"] ?? "");
|
|
47930
48165
|
const oldStr = String(args["old_string"] ?? "");
|
|
47931
48166
|
const newStr = String(args["new_string"] ?? "");
|
|
47932
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ?
|
|
48167
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join56(this.autoresearchDir, basename12(rawPath)) : join56(this.autoresearchDir, rawPath);
|
|
47933
48168
|
if (!targetPath.startsWith(this.autoresearchDir)) {
|
|
47934
48169
|
return { success: false, output: "", error: "Autoresearch mode: edits are confined to .oa/autoresearch/", durationMs: Date.now() - start };
|
|
47935
48170
|
}
|
|
47936
48171
|
try {
|
|
47937
|
-
if (!
|
|
48172
|
+
if (!existsSync40(targetPath)) {
|
|
47938
48173
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start };
|
|
47939
48174
|
}
|
|
47940
|
-
let content =
|
|
48175
|
+
let content = readFileSync29(targetPath, "utf-8");
|
|
47941
48176
|
if (!content.includes(oldStr)) {
|
|
47942
48177
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start };
|
|
47943
48178
|
}
|
|
47944
48179
|
content = content.replace(oldStr, newStr);
|
|
47945
|
-
|
|
48180
|
+
writeFileSync17(targetPath, content, "utf-8");
|
|
47946
48181
|
return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start };
|
|
47947
48182
|
} catch (err) {
|
|
47948
48183
|
return { success: false, output: "", error: String(err), durationMs: Date.now() - start };
|
|
@@ -47983,14 +48218,14 @@ var init_dream_engine = __esm({
|
|
|
47983
48218
|
const content = String(args["content"] ?? "");
|
|
47984
48219
|
if (!rawPath)
|
|
47985
48220
|
return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
|
|
47986
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ?
|
|
48221
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join56(this.dreamsDir, basename12(rawPath)) : join56(this.dreamsDir, rawPath);
|
|
47987
48222
|
if (!targetPath.startsWith(this.dreamsDir)) {
|
|
47988
48223
|
return { success: false, output: "", error: "Dream mode: writes are confined to .oa/dreams/", durationMs: Date.now() - start };
|
|
47989
48224
|
}
|
|
47990
48225
|
try {
|
|
47991
|
-
const dir =
|
|
47992
|
-
|
|
47993
|
-
|
|
48226
|
+
const dir = join56(targetPath, "..");
|
|
48227
|
+
mkdirSync17(dir, { recursive: true });
|
|
48228
|
+
writeFileSync17(targetPath, content, "utf-8");
|
|
47994
48229
|
return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
|
|
47995
48230
|
} catch (err) {
|
|
47996
48231
|
return { success: false, output: "", error: String(err), durationMs: Date.now() - start };
|
|
@@ -48018,20 +48253,20 @@ var init_dream_engine = __esm({
|
|
|
48018
48253
|
const rawPath = String(args["path"] ?? "");
|
|
48019
48254
|
const oldStr = String(args["old_string"] ?? "");
|
|
48020
48255
|
const newStr = String(args["new_string"] ?? "");
|
|
48021
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ?
|
|
48256
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join56(this.dreamsDir, basename12(rawPath)) : join56(this.dreamsDir, rawPath);
|
|
48022
48257
|
if (!targetPath.startsWith(this.dreamsDir)) {
|
|
48023
48258
|
return { success: false, output: "", error: "Dream mode: edits are confined to .oa/dreams/", durationMs: Date.now() - start };
|
|
48024
48259
|
}
|
|
48025
48260
|
try {
|
|
48026
|
-
if (!
|
|
48261
|
+
if (!existsSync40(targetPath)) {
|
|
48027
48262
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start };
|
|
48028
48263
|
}
|
|
48029
|
-
let content =
|
|
48264
|
+
let content = readFileSync29(targetPath, "utf-8");
|
|
48030
48265
|
if (!content.includes(oldStr)) {
|
|
48031
48266
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start };
|
|
48032
48267
|
}
|
|
48033
48268
|
content = content.replace(oldStr, newStr);
|
|
48034
|
-
|
|
48269
|
+
writeFileSync17(targetPath, content, "utf-8");
|
|
48035
48270
|
return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start };
|
|
48036
48271
|
} catch (err) {
|
|
48037
48272
|
return { success: false, output: "", error: String(err), durationMs: Date.now() - start };
|
|
@@ -48085,7 +48320,7 @@ var init_dream_engine = __esm({
|
|
|
48085
48320
|
constructor(config, repoRoot) {
|
|
48086
48321
|
this.config = config;
|
|
48087
48322
|
this.repoRoot = repoRoot;
|
|
48088
|
-
this.dreamsDir =
|
|
48323
|
+
this.dreamsDir = join56(repoRoot, ".oa", "dreams");
|
|
48089
48324
|
this.state = {
|
|
48090
48325
|
mode: "default",
|
|
48091
48326
|
active: false,
|
|
@@ -48116,7 +48351,7 @@ var init_dream_engine = __esm({
|
|
|
48116
48351
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
48117
48352
|
results: []
|
|
48118
48353
|
};
|
|
48119
|
-
|
|
48354
|
+
mkdirSync17(this.dreamsDir, { recursive: true });
|
|
48120
48355
|
this.saveDreamState();
|
|
48121
48356
|
try {
|
|
48122
48357
|
for (let cycle = 1; cycle <= totalCycles; cycle++) {
|
|
@@ -48169,8 +48404,8 @@ ${result.summary}`;
|
|
|
48169
48404
|
if (mode !== "default" || cycle === totalCycles) {
|
|
48170
48405
|
renderDreamContraction(cycle);
|
|
48171
48406
|
const cycleSummary = this.buildCycleSummary(cycle, previousFindings);
|
|
48172
|
-
const summaryPath =
|
|
48173
|
-
|
|
48407
|
+
const summaryPath = join56(this.dreamsDir, `cycle-${cycle}-summary.md`);
|
|
48408
|
+
writeFileSync17(summaryPath, cycleSummary, "utf-8");
|
|
48174
48409
|
}
|
|
48175
48410
|
if (mode === "lucid" && !this.abortController.signal.aborted) {
|
|
48176
48411
|
this.saveVersionCheckpoint(cycle);
|
|
@@ -48382,7 +48617,7 @@ After synthesis, call task_complete with the final prioritized summary.`, toolMo
|
|
|
48382
48617
|
}
|
|
48383
48618
|
/** Build role-specific tool sets for swarm agents */
|
|
48384
48619
|
buildSwarmTools(role, _workspace) {
|
|
48385
|
-
const autoresearchDir =
|
|
48620
|
+
const autoresearchDir = join56(this.repoRoot, ".oa", "autoresearch");
|
|
48386
48621
|
const taskComplete = this.createSwarmTaskCompleteTool(role);
|
|
48387
48622
|
switch (role) {
|
|
48388
48623
|
case "researcher": {
|
|
@@ -48746,7 +48981,7 @@ INSTRUCTIONS:
|
|
|
48746
48981
|
2. Summarize the key learnings and next steps
|
|
48747
48982
|
|
|
48748
48983
|
Call task_complete with a human-readable summary of the autoresearch session.`, workspace, onEvent);
|
|
48749
|
-
const reportPath =
|
|
48984
|
+
const reportPath = join56(this.dreamsDir, `cycle-${cycleNum}-autoresearch-report.md`);
|
|
48750
48985
|
const report = `# Autoresearch Swarm Report \u2014 Cycle ${cycleNum}
|
|
48751
48986
|
|
|
48752
48987
|
**Date**: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
|
|
@@ -48768,8 +49003,8 @@ ${summaryResult}
|
|
|
48768
49003
|
*Generated by open-agents autoresearch swarm*
|
|
48769
49004
|
`;
|
|
48770
49005
|
try {
|
|
48771
|
-
|
|
48772
|
-
|
|
49006
|
+
mkdirSync17(this.dreamsDir, { recursive: true });
|
|
49007
|
+
writeFileSync17(reportPath, report, "utf-8");
|
|
48773
49008
|
} catch {
|
|
48774
49009
|
}
|
|
48775
49010
|
renderSwarmComplete(workspace);
|
|
@@ -48835,9 +49070,9 @@ ${summaryResult}
|
|
|
48835
49070
|
}
|
|
48836
49071
|
/** Save workspace backup for lucid mode */
|
|
48837
49072
|
saveVersionCheckpoint(cycle) {
|
|
48838
|
-
const checkpointDir =
|
|
49073
|
+
const checkpointDir = join56(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
|
|
48839
49074
|
try {
|
|
48840
|
-
|
|
49075
|
+
mkdirSync17(checkpointDir, { recursive: true });
|
|
48841
49076
|
try {
|
|
48842
49077
|
const gitStatus = execSync28("git status --porcelain", {
|
|
48843
49078
|
cwd: this.repoRoot,
|
|
@@ -48854,10 +49089,10 @@ ${summaryResult}
|
|
|
48854
49089
|
encoding: "utf-8",
|
|
48855
49090
|
timeout: 5e3
|
|
48856
49091
|
}).trim();
|
|
48857
|
-
|
|
48858
|
-
|
|
48859
|
-
|
|
48860
|
-
|
|
49092
|
+
writeFileSync17(join56(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
|
|
49093
|
+
writeFileSync17(join56(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
|
|
49094
|
+
writeFileSync17(join56(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
|
|
49095
|
+
writeFileSync17(join56(checkpointDir, "checkpoint.json"), JSON.stringify({
|
|
48861
49096
|
cycle,
|
|
48862
49097
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
48863
49098
|
gitHash,
|
|
@@ -48865,7 +49100,7 @@ ${summaryResult}
|
|
|
48865
49100
|
}, null, 2), "utf-8");
|
|
48866
49101
|
renderInfo(`Checkpoint saved: cycle ${cycle} (${gitHash.slice(0, 8)})`);
|
|
48867
49102
|
} catch {
|
|
48868
|
-
|
|
49103
|
+
writeFileSync17(join56(checkpointDir, "checkpoint.json"), JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2), "utf-8");
|
|
48869
49104
|
renderInfo(`Checkpoint saved: cycle ${cycle} (no git)`);
|
|
48870
49105
|
}
|
|
48871
49106
|
} catch (err) {
|
|
@@ -48902,7 +49137,7 @@ Each proposal includes implementation entrypoints and estimated effort.
|
|
|
48902
49137
|
/** Update the master proposal index */
|
|
48903
49138
|
updateProposalIndex() {
|
|
48904
49139
|
try {
|
|
48905
|
-
const files =
|
|
49140
|
+
const files = readdirSync13(this.dreamsDir).filter((f) => f.endsWith(".md") && f !== "PROPOSAL-INDEX.md" && f !== "dream-state.json").sort();
|
|
48906
49141
|
const index = `# Dream Proposals Index
|
|
48907
49142
|
|
|
48908
49143
|
**Last updated**: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
|
|
@@ -48923,14 +49158,14 @@ ${files.map((f) => `- [\`${f}\`](./${f})`).join("\n")}
|
|
|
48923
49158
|
---
|
|
48924
49159
|
*Auto-generated by open-agents dream engine*
|
|
48925
49160
|
`;
|
|
48926
|
-
|
|
49161
|
+
writeFileSync17(join56(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
|
|
48927
49162
|
} catch {
|
|
48928
49163
|
}
|
|
48929
49164
|
}
|
|
48930
49165
|
/** Save dream state for resume/inspection */
|
|
48931
49166
|
saveDreamState() {
|
|
48932
49167
|
try {
|
|
48933
|
-
|
|
49168
|
+
writeFileSync17(join56(this.dreamsDir, "dream-state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
|
|
48934
49169
|
} catch {
|
|
48935
49170
|
}
|
|
48936
49171
|
}
|
|
@@ -49304,8 +49539,8 @@ var init_bless_engine = __esm({
|
|
|
49304
49539
|
});
|
|
49305
49540
|
|
|
49306
49541
|
// packages/cli/dist/tui/dmn-engine.js
|
|
49307
|
-
import { existsSync as
|
|
49308
|
-
import { join as
|
|
49542
|
+
import { existsSync as existsSync41, readFileSync as readFileSync30, writeFileSync as writeFileSync18, mkdirSync as mkdirSync18, readdirSync as readdirSync14, unlinkSync as unlinkSync9 } from "node:fs";
|
|
49543
|
+
import { join as join57, basename as basename13 } from "node:path";
|
|
49309
49544
|
function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
|
|
49310
49545
|
const competenceReport = competence.length > 0 ? competence.map((c3) => {
|
|
49311
49546
|
const rate = c3.attempts > 0 ? Math.round(c3.successes / c3.attempts * 100) : 0;
|
|
@@ -49418,9 +49653,9 @@ var init_dmn_engine = __esm({
|
|
|
49418
49653
|
constructor(config, repoRoot) {
|
|
49419
49654
|
this.config = config;
|
|
49420
49655
|
this.repoRoot = repoRoot;
|
|
49421
|
-
this.stateDir =
|
|
49422
|
-
this.historyDir =
|
|
49423
|
-
|
|
49656
|
+
this.stateDir = join57(repoRoot, ".oa", "dmn");
|
|
49657
|
+
this.historyDir = join57(repoRoot, ".oa", "dmn", "cycles");
|
|
49658
|
+
mkdirSync18(this.historyDir, { recursive: true });
|
|
49424
49659
|
this.loadState();
|
|
49425
49660
|
}
|
|
49426
49661
|
get stats() {
|
|
@@ -50009,14 +50244,14 @@ OUTPUT: Call task_complete with JSON:
|
|
|
50009
50244
|
async gatherMemoryTopics() {
|
|
50010
50245
|
const topics = [];
|
|
50011
50246
|
const dirs = [
|
|
50012
|
-
|
|
50013
|
-
|
|
50247
|
+
join57(this.repoRoot, ".oa", "memory"),
|
|
50248
|
+
join57(this.repoRoot, ".open-agents", "memory")
|
|
50014
50249
|
];
|
|
50015
50250
|
for (const dir of dirs) {
|
|
50016
|
-
if (!
|
|
50251
|
+
if (!existsSync41(dir))
|
|
50017
50252
|
continue;
|
|
50018
50253
|
try {
|
|
50019
|
-
const files =
|
|
50254
|
+
const files = readdirSync14(dir).filter((f) => f.endsWith(".json"));
|
|
50020
50255
|
for (const f of files) {
|
|
50021
50256
|
const topic = basename13(f, ".json");
|
|
50022
50257
|
if (!topics.includes(topic))
|
|
@@ -50029,29 +50264,29 @@ OUTPUT: Call task_complete with JSON:
|
|
|
50029
50264
|
}
|
|
50030
50265
|
// ── State persistence ─────────────────────────────────────────────────
|
|
50031
50266
|
loadState() {
|
|
50032
|
-
const path =
|
|
50033
|
-
if (
|
|
50267
|
+
const path = join57(this.stateDir, "state.json");
|
|
50268
|
+
if (existsSync41(path)) {
|
|
50034
50269
|
try {
|
|
50035
|
-
this.state = JSON.parse(
|
|
50270
|
+
this.state = JSON.parse(readFileSync30(path, "utf-8"));
|
|
50036
50271
|
} catch {
|
|
50037
50272
|
}
|
|
50038
50273
|
}
|
|
50039
50274
|
}
|
|
50040
50275
|
saveState() {
|
|
50041
50276
|
try {
|
|
50042
|
-
|
|
50277
|
+
writeFileSync18(join57(this.stateDir, "state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
|
|
50043
50278
|
} catch {
|
|
50044
50279
|
}
|
|
50045
50280
|
}
|
|
50046
50281
|
saveCycleResult(result) {
|
|
50047
50282
|
try {
|
|
50048
50283
|
const filename = `cycle-${result.cycleNumber}-${Date.now()}.json`;
|
|
50049
|
-
|
|
50050
|
-
const files =
|
|
50284
|
+
writeFileSync18(join57(this.historyDir, filename), JSON.stringify(result, null, 2) + "\n", "utf-8");
|
|
50285
|
+
const files = readdirSync14(this.historyDir).filter((f) => f.startsWith("cycle-") && f.endsWith(".json")).sort();
|
|
50051
50286
|
if (files.length > 50) {
|
|
50052
50287
|
for (const old of files.slice(0, files.length - 50)) {
|
|
50053
50288
|
try {
|
|
50054
|
-
unlinkSync9(
|
|
50289
|
+
unlinkSync9(join57(this.historyDir, old));
|
|
50055
50290
|
} catch {
|
|
50056
50291
|
}
|
|
50057
50292
|
}
|
|
@@ -50064,8 +50299,8 @@ OUTPUT: Call task_complete with JSON:
|
|
|
50064
50299
|
});
|
|
50065
50300
|
|
|
50066
50301
|
// packages/cli/dist/tui/snr-engine.js
|
|
50067
|
-
import { existsSync as
|
|
50068
|
-
import { join as
|
|
50302
|
+
import { existsSync as existsSync42, readdirSync as readdirSync15, readFileSync as readFileSync31 } from "node:fs";
|
|
50303
|
+
import { join as join58, basename as basename14 } from "node:path";
|
|
50069
50304
|
function computeDPrime(signalScores, noiseScores) {
|
|
50070
50305
|
if (signalScores.length === 0 || noiseScores.length === 0)
|
|
50071
50306
|
return 0;
|
|
@@ -50305,20 +50540,20 @@ Call task_complete with the JSON array when done.`, onEvent)
|
|
|
50305
50540
|
loadMemoryEntries(topics) {
|
|
50306
50541
|
const entries = [];
|
|
50307
50542
|
const dirs = [
|
|
50308
|
-
|
|
50309
|
-
|
|
50543
|
+
join58(this.repoRoot, ".oa", "memory"),
|
|
50544
|
+
join58(this.repoRoot, ".open-agents", "memory")
|
|
50310
50545
|
];
|
|
50311
50546
|
for (const dir of dirs) {
|
|
50312
|
-
if (!
|
|
50547
|
+
if (!existsSync42(dir))
|
|
50313
50548
|
continue;
|
|
50314
50549
|
try {
|
|
50315
|
-
const files =
|
|
50550
|
+
const files = readdirSync15(dir).filter((f) => f.endsWith(".json"));
|
|
50316
50551
|
for (const f of files) {
|
|
50317
50552
|
const topic = basename14(f, ".json");
|
|
50318
50553
|
if (topics.length > 0 && !topics.includes(topic))
|
|
50319
50554
|
continue;
|
|
50320
50555
|
try {
|
|
50321
|
-
const data = JSON.parse(
|
|
50556
|
+
const data = JSON.parse(readFileSync31(join58(dir, f), "utf-8"));
|
|
50322
50557
|
for (const [key, val] of Object.entries(data)) {
|
|
50323
50558
|
const value = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
50324
50559
|
entries.push({ topic, key, value });
|
|
@@ -50885,8 +51120,8 @@ var init_tool_policy = __esm({
|
|
|
50885
51120
|
});
|
|
50886
51121
|
|
|
50887
51122
|
// packages/cli/dist/tui/telegram-bridge.js
|
|
50888
|
-
import { mkdirSync as
|
|
50889
|
-
import { join as
|
|
51123
|
+
import { mkdirSync as mkdirSync19, existsSync as existsSync43, unlinkSync as unlinkSync10, readdirSync as readdirSync16, statSync as statSync14 } from "node:fs";
|
|
51124
|
+
import { join as join59, resolve as resolve28 } from "node:path";
|
|
50890
51125
|
import { writeFile as writeFileAsync } from "node:fs/promises";
|
|
50891
51126
|
function convertMarkdownToTelegramHTML(md) {
|
|
50892
51127
|
let html = md;
|
|
@@ -51214,7 +51449,7 @@ with summary "no_reply" to silently skip without responding.
|
|
|
51214
51449
|
this.polling = true;
|
|
51215
51450
|
this.abortController = new AbortController();
|
|
51216
51451
|
try {
|
|
51217
|
-
|
|
51452
|
+
mkdirSync19(this.mediaCacheDir, { recursive: true });
|
|
51218
51453
|
} catch {
|
|
51219
51454
|
}
|
|
51220
51455
|
this.mediaCacheCleanupTimer = setInterval(() => this.cleanupMediaCache(), 5 * 60 * 1e3);
|
|
@@ -51651,7 +51886,7 @@ Telegram admin: @${msg.username}` : `Telegram ${isGroup ? "group" : "public"} ch
|
|
|
51651
51886
|
return null;
|
|
51652
51887
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
51653
51888
|
const fileName = `${Date.now()}-${fileId.slice(0, 8)}${extension}`;
|
|
51654
|
-
const localPath =
|
|
51889
|
+
const localPath = join59(this.mediaCacheDir, fileName);
|
|
51655
51890
|
await writeFileAsync(localPath, buffer);
|
|
51656
51891
|
return localPath;
|
|
51657
51892
|
} catch {
|
|
@@ -52985,7 +53220,7 @@ var init_text_selection = __esm({
|
|
|
52985
53220
|
});
|
|
52986
53221
|
|
|
52987
53222
|
// packages/cli/dist/tui/status-bar.js
|
|
52988
|
-
import { readFileSync as
|
|
53223
|
+
import { readFileSync as readFileSync32 } from "node:fs";
|
|
52989
53224
|
function setTerminalTitle(task, version) {
|
|
52990
53225
|
if (!process.stdout.isTTY)
|
|
52991
53226
|
return;
|
|
@@ -53660,7 +53895,7 @@ var init_status_bar = __esm({
|
|
|
53660
53895
|
if (nexusDir) {
|
|
53661
53896
|
try {
|
|
53662
53897
|
const metricsPath = nexusDir + "/remote-metrics.json";
|
|
53663
|
-
const raw =
|
|
53898
|
+
const raw = readFileSync32(metricsPath, "utf8");
|
|
53664
53899
|
const cached = JSON.parse(raw);
|
|
53665
53900
|
if (cached && cached.ts && Date.now() - cached.ts < 6e4) {
|
|
53666
53901
|
const m = cached.data;
|
|
@@ -55091,11 +55326,11 @@ var init_mouse_filter = __esm({
|
|
|
55091
55326
|
import * as readline2 from "node:readline";
|
|
55092
55327
|
import { Writable } from "node:stream";
|
|
55093
55328
|
import { cwd } from "node:process";
|
|
55094
|
-
import { resolve as resolve29, join as
|
|
55329
|
+
import { resolve as resolve29, join as join60, dirname as dirname19, extname as extname10 } from "node:path";
|
|
55095
55330
|
import { createRequire as createRequire2 } from "node:module";
|
|
55096
55331
|
import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
55097
|
-
import { readFileSync as
|
|
55098
|
-
import { existsSync as
|
|
55332
|
+
import { readFileSync as readFileSync33, writeFileSync as writeFileSync19, appendFileSync as appendFileSync4, rmSync as rmSync3, readdirSync as readdirSync17, mkdirSync as mkdirSync20 } from "node:fs";
|
|
55333
|
+
import { existsSync as existsSync44 } from "node:fs";
|
|
55099
55334
|
import { execSync as execSync30 } from "node:child_process";
|
|
55100
55335
|
import { homedir as homedir13 } from "node:os";
|
|
55101
55336
|
function formatTimeAgo(date) {
|
|
@@ -55116,12 +55351,12 @@ function getVersion3() {
|
|
|
55116
55351
|
const require2 = createRequire2(import.meta.url);
|
|
55117
55352
|
const thisDir = dirname19(fileURLToPath12(import.meta.url));
|
|
55118
55353
|
const candidates = [
|
|
55119
|
-
|
|
55120
|
-
|
|
55121
|
-
|
|
55354
|
+
join60(thisDir, "..", "package.json"),
|
|
55355
|
+
join60(thisDir, "..", "..", "package.json"),
|
|
55356
|
+
join60(thisDir, "..", "..", "..", "package.json")
|
|
55122
55357
|
];
|
|
55123
55358
|
for (const pkgPath of candidates) {
|
|
55124
|
-
if (
|
|
55359
|
+
if (existsSync44(pkgPath)) {
|
|
55125
55360
|
const pkg = require2(pkgPath);
|
|
55126
55361
|
if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
|
|
55127
55362
|
return pkg.version ?? "0.0.0";
|
|
@@ -55342,15 +55577,15 @@ Use task_status("${taskId}") or task_output("${taskId}") to check progress.`
|
|
|
55342
55577
|
function gatherMemorySnippets(root) {
|
|
55343
55578
|
const snippets = [];
|
|
55344
55579
|
const dirs = [
|
|
55345
|
-
|
|
55346
|
-
|
|
55580
|
+
join60(root, ".oa", "memory"),
|
|
55581
|
+
join60(root, ".open-agents", "memory")
|
|
55347
55582
|
];
|
|
55348
55583
|
for (const dir of dirs) {
|
|
55349
|
-
if (!
|
|
55584
|
+
if (!existsSync44(dir))
|
|
55350
55585
|
continue;
|
|
55351
55586
|
try {
|
|
55352
|
-
for (const f of
|
|
55353
|
-
const data = JSON.parse(
|
|
55587
|
+
for (const f of readdirSync17(dir).filter((f2) => f2.endsWith(".json"))) {
|
|
55588
|
+
const data = JSON.parse(readFileSync33(join60(dir, f), "utf-8"));
|
|
55354
55589
|
for (const val of Object.values(data)) {
|
|
55355
55590
|
const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
55356
55591
|
if (v.length > 10)
|
|
@@ -55485,9 +55720,9 @@ ${metabolismMemories}
|
|
|
55485
55720
|
} catch {
|
|
55486
55721
|
}
|
|
55487
55722
|
try {
|
|
55488
|
-
const archeFile =
|
|
55489
|
-
if (
|
|
55490
|
-
const variants = JSON.parse(
|
|
55723
|
+
const archeFile = join60(repoRoot, ".oa", "arche", "variants.json");
|
|
55724
|
+
if (existsSync44(archeFile)) {
|
|
55725
|
+
const variants = JSON.parse(readFileSync33(archeFile, "utf8"));
|
|
55491
55726
|
if (variants.length > 0) {
|
|
55492
55727
|
let filtered = variants;
|
|
55493
55728
|
if (taskType) {
|
|
@@ -55624,9 +55859,9 @@ ${lines.join("\n")}
|
|
|
55624
55859
|
const compactionThreshold = modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
|
|
55625
55860
|
let identityInjection = "";
|
|
55626
55861
|
try {
|
|
55627
|
-
const ikStateFile =
|
|
55628
|
-
if (
|
|
55629
|
-
const selfState = JSON.parse(
|
|
55862
|
+
const ikStateFile = join60(repoRoot, ".oa", "identity", "self-state.json");
|
|
55863
|
+
if (existsSync44(ikStateFile)) {
|
|
55864
|
+
const selfState = JSON.parse(readFileSync33(ikStateFile, "utf8"));
|
|
55630
55865
|
const lines = [
|
|
55631
55866
|
`[Identity State v${selfState.version}]`,
|
|
55632
55867
|
`Self: ${selfState.narrative_summary}`,
|
|
@@ -56264,13 +56499,13 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
56264
56499
|
});
|
|
56265
56500
|
}
|
|
56266
56501
|
try {
|
|
56267
|
-
const ikDir =
|
|
56268
|
-
const ikFile =
|
|
56502
|
+
const ikDir = join60(repoRoot, ".oa", "identity");
|
|
56503
|
+
const ikFile = join60(ikDir, "self-state.json");
|
|
56269
56504
|
let ikState;
|
|
56270
|
-
if (
|
|
56271
|
-
ikState = JSON.parse(
|
|
56505
|
+
if (existsSync44(ikFile)) {
|
|
56506
|
+
ikState = JSON.parse(readFileSync33(ikFile, "utf8"));
|
|
56272
56507
|
} else {
|
|
56273
|
-
|
|
56508
|
+
mkdirSync20(ikDir, { recursive: true });
|
|
56274
56509
|
const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
|
|
56275
56510
|
ikState = {
|
|
56276
56511
|
self_id: `oa-${machineId}`,
|
|
@@ -56296,7 +56531,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
56296
56531
|
}
|
|
56297
56532
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
56298
56533
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
56299
|
-
|
|
56534
|
+
writeFileSync19(ikFile, JSON.stringify(ikState, null, 2));
|
|
56300
56535
|
} catch (ikErr) {
|
|
56301
56536
|
try {
|
|
56302
56537
|
console.error("[IK-OBSERVE]", ikErr);
|
|
@@ -56311,14 +56546,14 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
56311
56546
|
} else {
|
|
56312
56547
|
renderTaskIncomplete(result.turns, result.toolCalls, result.durationMs, tokens);
|
|
56313
56548
|
try {
|
|
56314
|
-
const ikFile =
|
|
56315
|
-
if (
|
|
56316
|
-
const ikState = JSON.parse(
|
|
56549
|
+
const ikFile = join60(repoRoot, ".oa", "identity", "self-state.json");
|
|
56550
|
+
if (existsSync44(ikFile)) {
|
|
56551
|
+
const ikState = JSON.parse(readFileSync33(ikFile, "utf8"));
|
|
56317
56552
|
ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
|
|
56318
56553
|
ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
|
|
56319
56554
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
56320
56555
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
56321
|
-
|
|
56556
|
+
writeFileSync19(ikFile, JSON.stringify(ikState, null, 2));
|
|
56322
56557
|
}
|
|
56323
56558
|
} catch {
|
|
56324
56559
|
}
|
|
@@ -56510,7 +56745,9 @@ async function startInteractive(config, repoPath) {
|
|
|
56510
56745
|
statusBar.renderHeaderButtons();
|
|
56511
56746
|
if (isResumed) {
|
|
56512
56747
|
statusBar.beginContentWrite();
|
|
56513
|
-
const
|
|
56748
|
+
const { getLastTaskSummary: getLastTaskSummary2 } = (init_oa_directory(), __toCommonJS(oa_directory_exports));
|
|
56749
|
+
const taskSummary = hasTaskToResume ? getLastTaskSummary2(repoRoot) : null;
|
|
56750
|
+
const resumeMsg = taskSummary ? `v${version} \u2014 picking up: ${taskSummary}` : `Updated to v${version}.`;
|
|
56514
56751
|
renderInfo(resumeMsg);
|
|
56515
56752
|
statusBar.endContentWrite();
|
|
56516
56753
|
}
|
|
@@ -56639,7 +56876,7 @@ async function startInteractive(config, repoPath) {
|
|
|
56639
56876
|
let p2pGateway = null;
|
|
56640
56877
|
let peerMesh = null;
|
|
56641
56878
|
let inferenceRouter = null;
|
|
56642
|
-
const secretVault = new SecretVault(
|
|
56879
|
+
const secretVault = new SecretVault(join60(repoRoot, ".oa", "vault.enc"));
|
|
56643
56880
|
let adminSessionKey = null;
|
|
56644
56881
|
const callSubAgents = /* @__PURE__ */ new Map();
|
|
56645
56882
|
const streamRenderer = new StreamRenderer();
|
|
@@ -56859,13 +57096,13 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
56859
57096
|
const hits = allCompletions.filter((c3) => c3.toLowerCase().startsWith(lower));
|
|
56860
57097
|
return [hits, line];
|
|
56861
57098
|
}
|
|
56862
|
-
const HISTORY_DIR =
|
|
56863
|
-
const HISTORY_FILE =
|
|
57099
|
+
const HISTORY_DIR = join60(homedir13(), ".open-agents");
|
|
57100
|
+
const HISTORY_FILE = join60(HISTORY_DIR, "repl-history");
|
|
56864
57101
|
const MAX_HISTORY_LINES = 500;
|
|
56865
57102
|
let savedHistory = [];
|
|
56866
57103
|
try {
|
|
56867
|
-
if (
|
|
56868
|
-
const raw =
|
|
57104
|
+
if (existsSync44(HISTORY_FILE)) {
|
|
57105
|
+
const raw = readFileSync33(HISTORY_FILE, "utf8").trim();
|
|
56869
57106
|
if (raw)
|
|
56870
57107
|
savedHistory = raw.split("\n").reverse();
|
|
56871
57108
|
}
|
|
@@ -56951,12 +57188,12 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
56951
57188
|
if (!line.trim())
|
|
56952
57189
|
return;
|
|
56953
57190
|
try {
|
|
56954
|
-
|
|
57191
|
+
mkdirSync20(HISTORY_DIR, { recursive: true });
|
|
56955
57192
|
appendFileSync4(HISTORY_FILE, line + "\n", "utf8");
|
|
56956
57193
|
if (Math.random() < 0.02) {
|
|
56957
|
-
const all =
|
|
57194
|
+
const all = readFileSync33(HISTORY_FILE, "utf8").trim().split("\n");
|
|
56958
57195
|
if (all.length > MAX_HISTORY_LINES) {
|
|
56959
|
-
|
|
57196
|
+
writeFileSync19(HISTORY_FILE, all.slice(-MAX_HISTORY_LINES).join("\n") + "\n", "utf8");
|
|
56960
57197
|
}
|
|
56961
57198
|
}
|
|
56962
57199
|
} catch {
|
|
@@ -57132,7 +57369,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
57132
57369
|
} catch {
|
|
57133
57370
|
}
|
|
57134
57371
|
try {
|
|
57135
|
-
const oaDir =
|
|
57372
|
+
const oaDir = join60(repoRoot, ".oa");
|
|
57136
57373
|
const reconnected = await ExposeGateway.checkAndReconnect(oaDir, {
|
|
57137
57374
|
onInfo: (msg) => writeContent(() => renderInfo(msg)),
|
|
57138
57375
|
onError: (msg) => writeContent(() => renderWarning(msg))
|
|
@@ -57155,7 +57392,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
57155
57392
|
} catch {
|
|
57156
57393
|
}
|
|
57157
57394
|
try {
|
|
57158
|
-
const oaDir =
|
|
57395
|
+
const oaDir = join60(repoRoot, ".oa");
|
|
57159
57396
|
const reconnectedP2P = await ExposeP2PGateway.checkAndReconnect(oaDir, new NexusTool(repoRoot), {
|
|
57160
57397
|
onInfo: (msg) => writeContent(() => renderInfo(msg)),
|
|
57161
57398
|
onError: (msg) => writeContent(() => renderWarning(msg))
|
|
@@ -58007,7 +58244,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
58007
58244
|
kind,
|
|
58008
58245
|
targetUrl,
|
|
58009
58246
|
authKey,
|
|
58010
|
-
stateDir:
|
|
58247
|
+
stateDir: join60(repoRoot, ".oa"),
|
|
58011
58248
|
passthrough: passthrough ?? false,
|
|
58012
58249
|
loadbalance: loadbalance ?? false,
|
|
58013
58250
|
endpointAuth: passthrough ? currentConfig.apiKey : void 0,
|
|
@@ -58055,7 +58292,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
58055
58292
|
await tunnelGateway.stop();
|
|
58056
58293
|
tunnelGateway = null;
|
|
58057
58294
|
}
|
|
58058
|
-
const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir:
|
|
58295
|
+
const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join60(repoRoot, ".oa") });
|
|
58059
58296
|
newTunnel.on("stats", (stats) => {
|
|
58060
58297
|
statusBar.setExposeStatus({
|
|
58061
58298
|
status: stats.status,
|
|
@@ -58291,13 +58528,13 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
58291
58528
|
return false;
|
|
58292
58529
|
setTimeout(() => {
|
|
58293
58530
|
const resumeContext = [
|
|
58294
|
-
`
|
|
58295
|
-
pendingTask.progressSummary ? `Progress
|
|
58296
|
-
pendingTask.filesModified.length > 0 ? `
|
|
58297
|
-
|
|
58298
|
-
|
|
58299
|
-
|
|
58300
|
-
writeContent(() => renderInfo(`
|
|
58531
|
+
`Continuing previous task: ${pendingTask.prompt}`,
|
|
58532
|
+
pendingTask.progressSummary ? `Progress: ${pendingTask.progressSummary}` : "",
|
|
58533
|
+
pendingTask.filesModified.length > 0 ? `Modified: ${pendingTask.filesModified.slice(0, 5).join(", ")}` : "",
|
|
58534
|
+
"Continue where you left off."
|
|
58535
|
+
].filter(Boolean).join("\n");
|
|
58536
|
+
const shortPrompt = pendingTask.prompt.slice(0, 40) + (pendingTask.prompt.length > 40 ? "..." : "");
|
|
58537
|
+
writeContent(() => renderInfo(`Picking up: ${shortPrompt}`));
|
|
58301
58538
|
rl.emit("line", resumeContext);
|
|
58302
58539
|
}, 100);
|
|
58303
58540
|
return true;
|
|
@@ -58324,10 +58561,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
58324
58561
|
writeContent(() => renderInfo(`Killed ${bgKilled} background task(s).`));
|
|
58325
58562
|
}
|
|
58326
58563
|
try {
|
|
58327
|
-
const nexusDir =
|
|
58328
|
-
const pidFile =
|
|
58329
|
-
if (
|
|
58330
|
-
const pid = parseInt(
|
|
58564
|
+
const nexusDir = join60(repoRoot, OA_DIR, "nexus");
|
|
58565
|
+
const pidFile = join60(nexusDir, "daemon.pid");
|
|
58566
|
+
if (existsSync44(pidFile)) {
|
|
58567
|
+
const pid = parseInt(readFileSync33(pidFile, "utf8").trim(), 10);
|
|
58331
58568
|
if (pid > 0) {
|
|
58332
58569
|
try {
|
|
58333
58570
|
if (process.platform === "win32") {
|
|
@@ -58349,13 +58586,13 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
58349
58586
|
} catch {
|
|
58350
58587
|
}
|
|
58351
58588
|
try {
|
|
58352
|
-
const voiceDir2 =
|
|
58589
|
+
const voiceDir2 = join60(homedir13(), ".open-agents", "voice");
|
|
58353
58590
|
const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
|
|
58354
58591
|
for (const pf of voicePidFiles) {
|
|
58355
|
-
const pidPath =
|
|
58356
|
-
if (
|
|
58592
|
+
const pidPath = join60(voiceDir2, pf);
|
|
58593
|
+
if (existsSync44(pidPath)) {
|
|
58357
58594
|
try {
|
|
58358
|
-
const pid = parseInt(
|
|
58595
|
+
const pid = parseInt(readFileSync33(pidPath, "utf8").trim(), 10);
|
|
58359
58596
|
if (pid > 0) {
|
|
58360
58597
|
if (process.platform === "win32") {
|
|
58361
58598
|
try {
|
|
@@ -58379,12 +58616,12 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
58379
58616
|
execSync30(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
|
|
58380
58617
|
} catch {
|
|
58381
58618
|
}
|
|
58382
|
-
const oaPath =
|
|
58383
|
-
if (
|
|
58619
|
+
const oaPath = join60(repoRoot, OA_DIR);
|
|
58620
|
+
if (existsSync44(oaPath)) {
|
|
58384
58621
|
let deleted = false;
|
|
58385
58622
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
58386
58623
|
try {
|
|
58387
|
-
|
|
58624
|
+
rmSync3(oaPath, { recursive: true, force: true });
|
|
58388
58625
|
deleted = true;
|
|
58389
58626
|
break;
|
|
58390
58627
|
} catch (err) {
|
|
@@ -58534,15 +58771,14 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
58534
58771
|
setTimeout(() => {
|
|
58535
58772
|
const sessionCtx = buildContextRestorePrompt(repoRoot);
|
|
58536
58773
|
const resumeContext = [
|
|
58537
|
-
sessionCtx
|
|
58538
|
-
|
|
58539
|
-
|
|
58540
|
-
pendingTask.
|
|
58541
|
-
|
|
58542
|
-
|
|
58543
|
-
|
|
58544
|
-
|
|
58545
|
-
writeContent(() => renderInfo(`Resuming task: ${pendingTask.prompt.slice(0, 100)}${pendingTask.prompt.length > 100 ? "..." : ""}`));
|
|
58774
|
+
sessionCtx || "",
|
|
58775
|
+
`Continuing task after update: ${pendingTask.prompt}`,
|
|
58776
|
+
pendingTask.progressSummary ? `Progress: ${pendingTask.progressSummary}` : "",
|
|
58777
|
+
pendingTask.filesModified.length > 0 ? `Modified: ${pendingTask.filesModified.slice(0, 5).join(", ")}` : "",
|
|
58778
|
+
"Continue where you left off."
|
|
58779
|
+
].filter(Boolean).join("\n");
|
|
58780
|
+
const shortPrompt = pendingTask.prompt.slice(0, 40) + (pendingTask.prompt.length > 40 ? "..." : "");
|
|
58781
|
+
writeContent(() => renderInfo(`Picking up: ${shortPrompt}`));
|
|
58546
58782
|
rl.emit("line", resumeContext);
|
|
58547
58783
|
}, 100);
|
|
58548
58784
|
}
|
|
@@ -58732,6 +58968,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
58732
58968
|
}, bruteForceEnabled, statusBar, handleSudoRequest, costTracker, (summary, meta) => {
|
|
58733
58969
|
lastCompletedSummary = summary;
|
|
58734
58970
|
lastTaskMeta = meta ?? null;
|
|
58971
|
+
setTerminalTitle(summary?.slice(0, 60), version);
|
|
58735
58972
|
}, currentTaskType, resolvedContextWindowSize, resolvedCaps, currentStyle, deepContextEnabled, compactionSNRCallback(), emotionEngine, flowEnabled, buildSlashCommandHandler(), thinkingEnabled, handleAskUser);
|
|
58736
58973
|
activeTask = task;
|
|
58737
58974
|
setTerminalTitle(input.slice(0, 60), version);
|
|
@@ -58752,8 +58989,8 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
58752
58989
|
}
|
|
58753
58990
|
}
|
|
58754
58991
|
const cleanPath = input.replace(/^['"]|['"]$/g, "").trim();
|
|
58755
|
-
const isImage = isImagePath(cleanPath) &&
|
|
58756
|
-
const isMedia = !isImage && isTranscribablePath(cleanPath) &&
|
|
58992
|
+
const isImage = isImagePath(cleanPath) && existsSync44(resolve29(repoRoot, cleanPath));
|
|
58993
|
+
const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync44(resolve29(repoRoot, cleanPath));
|
|
58757
58994
|
if (activeTask) {
|
|
58758
58995
|
if (activeTask.runner.isPaused) {
|
|
58759
58996
|
activeTask.runner.resume();
|
|
@@ -58762,7 +58999,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
58762
58999
|
if (isImage) {
|
|
58763
59000
|
try {
|
|
58764
59001
|
const imgPath = resolve29(repoRoot, cleanPath);
|
|
58765
|
-
const imgBuffer =
|
|
59002
|
+
const imgBuffer = readFileSync33(imgPath);
|
|
58766
59003
|
const base64 = imgBuffer.toString("base64");
|
|
58767
59004
|
const ext = extname10(cleanPath).toLowerCase();
|
|
58768
59005
|
const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
|
|
@@ -58985,6 +59222,7 @@ NEW TASK: ${fullInput}`;
|
|
|
58985
59222
|
}, bruteForceEnabled, statusBar, handleSudoRequest, costTracker, (summary, meta) => {
|
|
58986
59223
|
lastCompletedSummary = summary;
|
|
58987
59224
|
lastTaskMeta = meta ?? null;
|
|
59225
|
+
setTerminalTitle(summary?.slice(0, 60), version);
|
|
58988
59226
|
}, currentTaskType, resolvedContextWindowSize, resolvedCaps, currentStyle, deepContextEnabled, compactionSNRCallback(), emotionEngine, flowEnabled, buildSlashCommandHandler(), thinkingEnabled, handleAskUser);
|
|
58989
59227
|
activeTask = task;
|
|
58990
59228
|
setTerminalTitle(input.slice(0, 60), version);
|
|
@@ -59259,13 +59497,13 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
59259
59497
|
const handle = startTask(task, config, repoRoot);
|
|
59260
59498
|
await handle.promise;
|
|
59261
59499
|
try {
|
|
59262
|
-
const ikDir =
|
|
59263
|
-
const ikFile =
|
|
59500
|
+
const ikDir = join60(repoRoot, ".oa", "identity");
|
|
59501
|
+
const ikFile = join60(ikDir, "self-state.json");
|
|
59264
59502
|
let ikState;
|
|
59265
|
-
if (
|
|
59266
|
-
ikState = JSON.parse(
|
|
59503
|
+
if (existsSync44(ikFile)) {
|
|
59504
|
+
ikState = JSON.parse(readFileSync33(ikFile, "utf8"));
|
|
59267
59505
|
} else {
|
|
59268
|
-
|
|
59506
|
+
mkdirSync20(ikDir, { recursive: true });
|
|
59269
59507
|
ikState = {
|
|
59270
59508
|
self_id: `oa-${Date.now().toString(36)}`,
|
|
59271
59509
|
version: 1,
|
|
@@ -59287,7 +59525,7 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
59287
59525
|
ikState.homeostasis.coherence = Math.min(1, ikState.homeostasis.coherence + 0.05);
|
|
59288
59526
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
59289
59527
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
59290
|
-
|
|
59528
|
+
writeFileSync19(ikFile, JSON.stringify(ikState, null, 2));
|
|
59291
59529
|
} catch (ikErr) {
|
|
59292
59530
|
}
|
|
59293
59531
|
try {
|
|
@@ -59296,12 +59534,12 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
59296
59534
|
ec.archiveVariantSync(`Task: ${task.slice(0, 200)}`, "success \u2014 completed", ["general"]);
|
|
59297
59535
|
} catch {
|
|
59298
59536
|
try {
|
|
59299
|
-
const archeDir =
|
|
59300
|
-
const archeFile =
|
|
59537
|
+
const archeDir = join60(repoRoot, ".oa", "arche");
|
|
59538
|
+
const archeFile = join60(archeDir, "variants.json");
|
|
59301
59539
|
let variants = [];
|
|
59302
59540
|
try {
|
|
59303
|
-
if (
|
|
59304
|
-
variants = JSON.parse(
|
|
59541
|
+
if (existsSync44(archeFile))
|
|
59542
|
+
variants = JSON.parse(readFileSync33(archeFile, "utf8"));
|
|
59305
59543
|
} catch {
|
|
59306
59544
|
}
|
|
59307
59545
|
variants.push({
|
|
@@ -59316,15 +59554,15 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
59316
59554
|
});
|
|
59317
59555
|
if (variants.length > 50)
|
|
59318
59556
|
variants = variants.slice(-50);
|
|
59319
|
-
|
|
59320
|
-
|
|
59557
|
+
mkdirSync20(archeDir, { recursive: true });
|
|
59558
|
+
writeFileSync19(archeFile, JSON.stringify(variants, null, 2));
|
|
59321
59559
|
} catch {
|
|
59322
59560
|
}
|
|
59323
59561
|
}
|
|
59324
59562
|
try {
|
|
59325
|
-
const metaFile =
|
|
59326
|
-
if (
|
|
59327
|
-
const store = JSON.parse(
|
|
59563
|
+
const metaFile = join60(repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
59564
|
+
if (existsSync44(metaFile)) {
|
|
59565
|
+
const store = JSON.parse(readFileSync33(metaFile, "utf8"));
|
|
59328
59566
|
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);
|
|
59329
59567
|
let updated = false;
|
|
59330
59568
|
for (const item of surfaced) {
|
|
@@ -59335,7 +59573,7 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
59335
59573
|
updated = true;
|
|
59336
59574
|
}
|
|
59337
59575
|
if (updated) {
|
|
59338
|
-
|
|
59576
|
+
writeFileSync19(metaFile, JSON.stringify(store, null, 2));
|
|
59339
59577
|
}
|
|
59340
59578
|
}
|
|
59341
59579
|
} catch {
|
|
@@ -59388,9 +59626,9 @@ Rules:
|
|
|
59388
59626
|
try {
|
|
59389
59627
|
const { initDb: initDb2 } = __require("@open-agents/memory");
|
|
59390
59628
|
const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
|
|
59391
|
-
const dbDir =
|
|
59392
|
-
|
|
59393
|
-
const db = initDb2(
|
|
59629
|
+
const dbDir = join60(repoRoot, ".oa", "memory");
|
|
59630
|
+
mkdirSync20(dbDir, { recursive: true });
|
|
59631
|
+
const db = initDb2(join60(dbDir, "structured.db"));
|
|
59394
59632
|
const memStore = new ProceduralMemoryStore2(db);
|
|
59395
59633
|
memStore.createWithEmbedding({
|
|
59396
59634
|
content: content.slice(0, 600),
|
|
@@ -59405,12 +59643,12 @@ Rules:
|
|
|
59405
59643
|
db.close();
|
|
59406
59644
|
} catch {
|
|
59407
59645
|
}
|
|
59408
|
-
const metaDir =
|
|
59409
|
-
const storeFile =
|
|
59646
|
+
const metaDir = join60(repoRoot, ".oa", "memory", "metabolism");
|
|
59647
|
+
const storeFile = join60(metaDir, "store.json");
|
|
59410
59648
|
let store = [];
|
|
59411
59649
|
try {
|
|
59412
|
-
if (
|
|
59413
|
-
store = JSON.parse(
|
|
59650
|
+
if (existsSync44(storeFile))
|
|
59651
|
+
store = JSON.parse(readFileSync33(storeFile, "utf8"));
|
|
59414
59652
|
} catch {
|
|
59415
59653
|
}
|
|
59416
59654
|
store.push({
|
|
@@ -59426,26 +59664,26 @@ Rules:
|
|
|
59426
59664
|
});
|
|
59427
59665
|
if (store.length > 100)
|
|
59428
59666
|
store = store.slice(-100);
|
|
59429
|
-
|
|
59430
|
-
|
|
59667
|
+
mkdirSync20(metaDir, { recursive: true });
|
|
59668
|
+
writeFileSync19(storeFile, JSON.stringify(store, null, 2));
|
|
59431
59669
|
}
|
|
59432
59670
|
}
|
|
59433
59671
|
} catch {
|
|
59434
59672
|
}
|
|
59435
59673
|
try {
|
|
59436
|
-
const cohereSettingsFile =
|
|
59674
|
+
const cohereSettingsFile = join60(repoRoot, ".oa", "settings.json");
|
|
59437
59675
|
let cohereActive = false;
|
|
59438
59676
|
try {
|
|
59439
|
-
if (
|
|
59440
|
-
const settings = JSON.parse(
|
|
59677
|
+
if (existsSync44(cohereSettingsFile)) {
|
|
59678
|
+
const settings = JSON.parse(readFileSync33(cohereSettingsFile, "utf8"));
|
|
59441
59679
|
cohereActive = settings.cohere === true;
|
|
59442
59680
|
}
|
|
59443
59681
|
} catch {
|
|
59444
59682
|
}
|
|
59445
59683
|
if (cohereActive) {
|
|
59446
|
-
const metaFile =
|
|
59447
|
-
if (
|
|
59448
|
-
const store = JSON.parse(
|
|
59684
|
+
const metaFile = join60(repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
59685
|
+
if (existsSync44(metaFile)) {
|
|
59686
|
+
const store = JSON.parse(readFileSync33(metaFile, "utf8"));
|
|
59449
59687
|
const latest = store.filter((m) => m.sourceTrace === "trajectory-extraction" || m.sourceTrace === "llm-trajectory-extraction").slice(-1)[0];
|
|
59450
59688
|
if (latest && latest.scores?.confidence >= 0.6) {
|
|
59451
59689
|
try {
|
|
@@ -59470,18 +59708,18 @@ Rules:
|
|
|
59470
59708
|
}
|
|
59471
59709
|
} catch (err) {
|
|
59472
59710
|
try {
|
|
59473
|
-
const ikFile =
|
|
59474
|
-
if (
|
|
59475
|
-
const ikState = JSON.parse(
|
|
59711
|
+
const ikFile = join60(repoRoot, ".oa", "identity", "self-state.json");
|
|
59712
|
+
if (existsSync44(ikFile)) {
|
|
59713
|
+
const ikState = JSON.parse(readFileSync33(ikFile, "utf8"));
|
|
59476
59714
|
ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
|
|
59477
59715
|
ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
|
|
59478
59716
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
59479
59717
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
59480
|
-
|
|
59718
|
+
writeFileSync19(ikFile, JSON.stringify(ikState, null, 2));
|
|
59481
59719
|
}
|
|
59482
|
-
const metaFile =
|
|
59483
|
-
if (
|
|
59484
|
-
const store = JSON.parse(
|
|
59720
|
+
const metaFile = join60(repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
59721
|
+
if (existsSync44(metaFile)) {
|
|
59722
|
+
const store = JSON.parse(readFileSync33(metaFile, "utf8"));
|
|
59485
59723
|
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);
|
|
59486
59724
|
for (const item of surfaced) {
|
|
59487
59725
|
item.accessCount = (item.accessCount || 0) + 1;
|
|
@@ -59489,15 +59727,15 @@ Rules:
|
|
|
59489
59727
|
item.scores.utility = Math.max(0, (item.scores.utility || 0.5) - 0.05);
|
|
59490
59728
|
item.scores.confidence = Math.max(0, (item.scores.confidence || 0.5) - 0.02);
|
|
59491
59729
|
}
|
|
59492
|
-
|
|
59730
|
+
writeFileSync19(metaFile, JSON.stringify(store, null, 2));
|
|
59493
59731
|
}
|
|
59494
59732
|
try {
|
|
59495
|
-
const archeDir =
|
|
59496
|
-
const archeFile =
|
|
59733
|
+
const archeDir = join60(repoRoot, ".oa", "arche");
|
|
59734
|
+
const archeFile = join60(archeDir, "variants.json");
|
|
59497
59735
|
let variants = [];
|
|
59498
59736
|
try {
|
|
59499
|
-
if (
|
|
59500
|
-
variants = JSON.parse(
|
|
59737
|
+
if (existsSync44(archeFile))
|
|
59738
|
+
variants = JSON.parse(readFileSync33(archeFile, "utf8"));
|
|
59501
59739
|
} catch {
|
|
59502
59740
|
}
|
|
59503
59741
|
variants.push({
|
|
@@ -59512,8 +59750,8 @@ Rules:
|
|
|
59512
59750
|
});
|
|
59513
59751
|
if (variants.length > 50)
|
|
59514
59752
|
variants = variants.slice(-50);
|
|
59515
|
-
|
|
59516
|
-
|
|
59753
|
+
mkdirSync20(archeDir, { recursive: true });
|
|
59754
|
+
writeFileSync19(archeFile, JSON.stringify(variants, null, 2));
|
|
59517
59755
|
} catch {
|
|
59518
59756
|
}
|
|
59519
59757
|
} catch {
|
|
@@ -59598,7 +59836,7 @@ import { glob } from "glob";
|
|
|
59598
59836
|
import ignore from "ignore";
|
|
59599
59837
|
import { readFile as readFile22, stat as stat4 } from "node:fs/promises";
|
|
59600
59838
|
import { createHash as createHash4 } from "node:crypto";
|
|
59601
|
-
import { join as
|
|
59839
|
+
import { join as join61, relative as relative3, extname as extname11, basename as basename15 } from "node:path";
|
|
59602
59840
|
var DEFAULT_EXCLUDE, LANGUAGE_MAP, CodebaseIndexer;
|
|
59603
59841
|
var init_codebase_indexer = __esm({
|
|
59604
59842
|
"packages/indexer/dist/codebase-indexer.js"() {
|
|
@@ -59642,7 +59880,7 @@ var init_codebase_indexer = __esm({
|
|
|
59642
59880
|
const ig = ignore.default();
|
|
59643
59881
|
if (this.config.respectGitignore) {
|
|
59644
59882
|
try {
|
|
59645
|
-
const gitignoreContent = await readFile22(
|
|
59883
|
+
const gitignoreContent = await readFile22(join61(this.config.rootDir, ".gitignore"), "utf-8");
|
|
59646
59884
|
ig.add(gitignoreContent);
|
|
59647
59885
|
} catch {
|
|
59648
59886
|
}
|
|
@@ -59657,7 +59895,7 @@ var init_codebase_indexer = __esm({
|
|
|
59657
59895
|
for (const relativePath of files) {
|
|
59658
59896
|
if (ig.ignores(relativePath))
|
|
59659
59897
|
continue;
|
|
59660
|
-
const fullPath =
|
|
59898
|
+
const fullPath = join61(this.config.rootDir, relativePath);
|
|
59661
59899
|
try {
|
|
59662
59900
|
const fileStat = await stat4(fullPath);
|
|
59663
59901
|
if (fileStat.size > this.config.maxFileSize)
|
|
@@ -59703,7 +59941,7 @@ var init_codebase_indexer = __esm({
|
|
|
59703
59941
|
if (!child) {
|
|
59704
59942
|
child = {
|
|
59705
59943
|
name: part,
|
|
59706
|
-
path:
|
|
59944
|
+
path: join61(current.path, part),
|
|
59707
59945
|
type: "directory",
|
|
59708
59946
|
children: []
|
|
59709
59947
|
};
|
|
@@ -59786,17 +60024,17 @@ __export(index_repo_exports, {
|
|
|
59786
60024
|
indexRepoCommand: () => indexRepoCommand
|
|
59787
60025
|
});
|
|
59788
60026
|
import { resolve as resolve30 } from "node:path";
|
|
59789
|
-
import { existsSync as
|
|
60027
|
+
import { existsSync as existsSync45, statSync as statSync15 } from "node:fs";
|
|
59790
60028
|
import { cwd as cwd2 } from "node:process";
|
|
59791
60029
|
async function indexRepoCommand(opts, _config) {
|
|
59792
60030
|
const repoRoot = resolve30(opts.repoPath ?? cwd2());
|
|
59793
60031
|
printHeader("Index Repository");
|
|
59794
60032
|
printInfo(`Indexing: ${repoRoot}`);
|
|
59795
|
-
if (!
|
|
60033
|
+
if (!existsSync45(repoRoot)) {
|
|
59796
60034
|
printError(`Path does not exist: ${repoRoot}`);
|
|
59797
60035
|
process.exit(1);
|
|
59798
60036
|
}
|
|
59799
|
-
const stat5 =
|
|
60037
|
+
const stat5 = statSync15(repoRoot);
|
|
59800
60038
|
if (!stat5.isDirectory()) {
|
|
59801
60039
|
printError(`Path is not a directory: ${repoRoot}`);
|
|
59802
60040
|
process.exit(1);
|
|
@@ -60044,7 +60282,7 @@ var config_exports = {};
|
|
|
60044
60282
|
__export(config_exports, {
|
|
60045
60283
|
configCommand: () => configCommand
|
|
60046
60284
|
});
|
|
60047
|
-
import { join as
|
|
60285
|
+
import { join as join62, resolve as resolve31 } from "node:path";
|
|
60048
60286
|
import { homedir as homedir14 } from "node:os";
|
|
60049
60287
|
import { cwd as cwd3 } from "node:process";
|
|
60050
60288
|
function redactIfSensitive(key, value) {
|
|
@@ -60127,7 +60365,7 @@ function handleShow(opts, config) {
|
|
|
60127
60365
|
}
|
|
60128
60366
|
}
|
|
60129
60367
|
printSection("Config File");
|
|
60130
|
-
printInfo(`~/.open-agents/config.json (${
|
|
60368
|
+
printInfo(`~/.open-agents/config.json (${join62(homedir14(), ".open-agents", "config.json")})`);
|
|
60131
60369
|
printSection("Priority Chain");
|
|
60132
60370
|
printInfo(" 1. CLI flags (--model, --backend-url, etc.)");
|
|
60133
60371
|
printInfo(" 2. Project .oa/settings.json (--local)");
|
|
@@ -60166,7 +60404,7 @@ function handleSet(opts, _config) {
|
|
|
60166
60404
|
const coerced = coerceForSettings(key, value);
|
|
60167
60405
|
saveProjectSettings(repoRoot, { [key]: coerced });
|
|
60168
60406
|
printSuccess(`Project override set: ${key} = ${redactIfSensitive(key, value)}`);
|
|
60169
|
-
printInfo(`Saved to ${
|
|
60407
|
+
printInfo(`Saved to ${join62(repoRoot, ".oa", "settings.json")}`);
|
|
60170
60408
|
printInfo("This override applies only when running in this workspace.");
|
|
60171
60409
|
} catch (err) {
|
|
60172
60410
|
printError(`Failed to save: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -60424,8 +60662,8 @@ __export(eval_exports, {
|
|
|
60424
60662
|
evalCommand: () => evalCommand
|
|
60425
60663
|
});
|
|
60426
60664
|
import { tmpdir as tmpdir10 } from "node:os";
|
|
60427
|
-
import { mkdirSync as
|
|
60428
|
-
import { join as
|
|
60665
|
+
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync20 } from "node:fs";
|
|
60666
|
+
import { join as join63 } from "node:path";
|
|
60429
60667
|
async function evalCommand(opts, config) {
|
|
60430
60668
|
const suiteName = opts.suite ?? "basic";
|
|
60431
60669
|
const suite = SUITES[suiteName];
|
|
@@ -60550,9 +60788,9 @@ async function evalCommand(opts, config) {
|
|
|
60550
60788
|
process.exit(failed > 0 ? 1 : 0);
|
|
60551
60789
|
}
|
|
60552
60790
|
function createTempEvalRepo() {
|
|
60553
|
-
const dir =
|
|
60554
|
-
|
|
60555
|
-
|
|
60791
|
+
const dir = join63(tmpdir10(), `open-agents-eval-${Date.now()}`);
|
|
60792
|
+
mkdirSync21(dir, { recursive: true });
|
|
60793
|
+
writeFileSync20(join63(dir, "package.json"), JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n", "utf8");
|
|
60556
60794
|
return dir;
|
|
60557
60795
|
}
|
|
60558
60796
|
var BASIC_SUITE, FULL_SUITE, SUITES;
|
|
@@ -60612,7 +60850,7 @@ init_updater();
|
|
|
60612
60850
|
import { parseArgs as nodeParseArgs2 } from "node:util";
|
|
60613
60851
|
import { createRequire as createRequire3 } from "node:module";
|
|
60614
60852
|
import { fileURLToPath as fileURLToPath13 } from "node:url";
|
|
60615
|
-
import { dirname as dirname20, join as
|
|
60853
|
+
import { dirname as dirname20, join as join64 } from "node:path";
|
|
60616
60854
|
|
|
60617
60855
|
// packages/cli/dist/cli.js
|
|
60618
60856
|
import { createInterface } from "node:readline";
|
|
@@ -60719,7 +60957,7 @@ init_output();
|
|
|
60719
60957
|
function getVersion4() {
|
|
60720
60958
|
try {
|
|
60721
60959
|
const require2 = createRequire3(import.meta.url);
|
|
60722
|
-
const pkgPath =
|
|
60960
|
+
const pkgPath = join64(dirname20(fileURLToPath13(import.meta.url)), "..", "package.json");
|
|
60723
60961
|
const pkg = require2(pkgPath);
|
|
60724
60962
|
return pkg.version;
|
|
60725
60963
|
} catch {
|