open-agents-ai 0.138.77 → 0.138.78
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 +49 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -54257,7 +54257,7 @@ function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce
|
|
|
54257
54257
|
try {
|
|
54258
54258
|
const { MemoryMetabolismTool: MemoryMetabolismTool2 } = __require("@open-agents/execution");
|
|
54259
54259
|
const mm = new MemoryMetabolismTool2(repoRoot);
|
|
54260
|
-
const metabolismMemories = mm.getTopMemoriesSync(
|
|
54260
|
+
const metabolismMemories = mm.getTopMemoriesSync(2, taskType || void 0);
|
|
54261
54261
|
if (metabolismMemories) {
|
|
54262
54262
|
dynamicContext += `
|
|
54263
54263
|
|
|
@@ -58078,6 +58078,54 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
58078
58078
|
}
|
|
58079
58079
|
} catch {
|
|
58080
58080
|
}
|
|
58081
|
+
try {
|
|
58082
|
+
const ts = handle.runner?.taskState;
|
|
58083
|
+
if (ts && ts.toolCallCount > 2) {
|
|
58084
|
+
let category = "strategy";
|
|
58085
|
+
let lesson = "";
|
|
58086
|
+
if (ts.failedApproaches && ts.failedApproaches.length > 0) {
|
|
58087
|
+
category = "recovery";
|
|
58088
|
+
const failed = ts.failedApproaches.slice(0, 2).join("; ");
|
|
58089
|
+
const worked = ts.completedSteps?.slice(-2).join(" \u2192 ") || "completed task";
|
|
58090
|
+
lesson = `[recovery] Avoid: ${failed}. Instead: ${worked}`;
|
|
58091
|
+
} else if (ts.completedSteps && ts.completedSteps.length > 1) {
|
|
58092
|
+
lesson = `[strategy] ${ts.completedSteps.slice(-3).join(" \u2192 ")}`;
|
|
58093
|
+
} else {
|
|
58094
|
+
lesson = `[strategy] Solved: ${task.slice(0, 150)}`;
|
|
58095
|
+
}
|
|
58096
|
+
if (lesson) {
|
|
58097
|
+
const metaDir = join59(repoRoot, ".oa", "memory", "metabolism");
|
|
58098
|
+
const storeFile = join59(metaDir, "store.json");
|
|
58099
|
+
let store = [];
|
|
58100
|
+
try {
|
|
58101
|
+
if (existsSync43(storeFile))
|
|
58102
|
+
store = JSON.parse(readFileSync32(storeFile, "utf8"));
|
|
58103
|
+
} catch {
|
|
58104
|
+
}
|
|
58105
|
+
store.push({
|
|
58106
|
+
id: `mem-traj-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`,
|
|
58107
|
+
type: "procedural",
|
|
58108
|
+
content: lesson.slice(0, 500),
|
|
58109
|
+
sourceTrace: "trajectory-extraction",
|
|
58110
|
+
scores: {
|
|
58111
|
+
novelty: 0.6,
|
|
58112
|
+
utility: category === "recovery" ? 0.8 : 0.6,
|
|
58113
|
+
confidence: 0.7,
|
|
58114
|
+
identityRelevance: 0.3
|
|
58115
|
+
},
|
|
58116
|
+
decision: { action: "admit", reason: `Auto-extracted ${category} from task (${ts.toolCallCount} tool calls)` },
|
|
58117
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
58118
|
+
lastAccessedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
58119
|
+
accessCount: 0
|
|
58120
|
+
});
|
|
58121
|
+
if (store.length > 100)
|
|
58122
|
+
store = store.slice(-100);
|
|
58123
|
+
mkdirSync19(metaDir, { recursive: true });
|
|
58124
|
+
writeFileSync18(storeFile, JSON.stringify(store, null, 2));
|
|
58125
|
+
}
|
|
58126
|
+
}
|
|
58127
|
+
} catch {
|
|
58128
|
+
}
|
|
58081
58129
|
} catch (err) {
|
|
58082
58130
|
try {
|
|
58083
58131
|
const ikFile = join59(repoRoot, ".oa", "identity", "self-state.json");
|
package/package.json
CHANGED