open-agents-ai 0.138.69 → 0.138.70

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.
Files changed (2) hide show
  1. package/dist/index.js +46 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12885,6 +12885,38 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
12885
12885
  durationMs: performance.now() - start
12886
12886
  };
12887
12887
  }
12888
+ // ── Retrieval for context injection (WO-FL2) ─────────────────────────
12889
+ // Per MemRL (arXiv:2601.03192): rank by utility * confidence (outcome-weighted),
12890
+ // not text similarity. Per FSM paper: filter by task phase when available.
12891
+ /**
12892
+ * Retrieve top-K memories ranked by utility * confidence.
12893
+ * Returns formatted string for system prompt injection, or "" if none.
12894
+ * Optionally filter by task type for phase-aware context (FSM paper insight).
12895
+ */
12896
+ getTopMemoriesSync(k = 5, taskType) {
12897
+ const { readFileSync: readFileSync33, existsSync: existsSync45 } = __require("node:fs");
12898
+ const metaDir = join21(this.cwd, ".oa", "memory", "metabolism");
12899
+ const storeFile = join21(metaDir, "store.json");
12900
+ if (!existsSync45(storeFile))
12901
+ return "";
12902
+ let store = [];
12903
+ try {
12904
+ store = JSON.parse(readFileSync33(storeFile, "utf8"));
12905
+ } catch {
12906
+ return "";
12907
+ }
12908
+ let items = store.filter((m) => m.type !== "quarantine" && m.scores.confidence > 0.15);
12909
+ if (taskType) {
12910
+ const typeMatch = items.filter((m) => m.content.toLowerCase().includes(taskType.toLowerCase()) || m.sourceTrace.toLowerCase().includes(taskType.toLowerCase()));
12911
+ if (typeMatch.length >= 2)
12912
+ items = typeMatch;
12913
+ }
12914
+ items.sort((a, b) => b.scores.utility * b.scores.confidence - a.scores.utility * a.scores.confidence);
12915
+ const top = items.slice(0, k);
12916
+ if (top.length === 0)
12917
+ return "";
12918
+ return top.map((m) => `- [${m.type}] ${m.content.slice(0, 200)} (confidence: ${m.scores.confidence.toFixed(2)}, utility: ${m.scores.utility.toFixed(2)})`).join("\n");
12919
+ }
12888
12920
  // ── Storage ──────────────────────────────────────────────────────────
12889
12921
  async loadStore(dir) {
12890
12922
  try {
@@ -54098,6 +54130,20 @@ function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce
54098
54130
  const modelTier = getModelTier(config.model);
54099
54131
  const projectCtx = buildProjectContext(repoRoot, taskStores?.contextStores);
54100
54132
  let dynamicContext = formatContextForPrompt(projectCtx, modelTier);
54133
+ try {
54134
+ const { MemoryMetabolismTool: MemoryMetabolismTool2 } = __require("@open-agents/execution");
54135
+ const mm = new MemoryMetabolismTool2(repoRoot);
54136
+ const metabolismMemories = mm.getTopMemoriesSync(5, taskType || void 0);
54137
+ if (metabolismMemories) {
54138
+ dynamicContext += `
54139
+
54140
+ <learned-memories>
54141
+ Persistent learnings from previous tasks (COHERE Memory Metabolism):
54142
+ ${metabolismMemories}
54143
+ </learned-memories>`;
54144
+ }
54145
+ } catch {
54146
+ }
54101
54147
  if (taskType && modelTier !== "small") {
54102
54148
  dynamicContext += "\n\n" + buildTaskContext(taskType);
54103
54149
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.138.69",
3
+ "version": "0.138.70",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",