open-agents-ai 0.138.68 → 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.
- package/dist/index.js +82 -1
- 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 {
|
|
@@ -21985,6 +22017,17 @@ var init_agenticRunner = __esm({
|
|
|
21985
22017
|
tokenEstimate: Math.ceil(personalitySuffix.length / 4)
|
|
21986
22018
|
});
|
|
21987
22019
|
}
|
|
22020
|
+
if (this.options.identityInjection) {
|
|
22021
|
+
sections.push({
|
|
22022
|
+
label: "c_identity",
|
|
22023
|
+
content: `
|
|
22024
|
+
|
|
22025
|
+
<identity-state>
|
|
22026
|
+
${this.options.identityInjection}
|
|
22027
|
+
</identity-state>`,
|
|
22028
|
+
tokenEstimate: Math.ceil(this.options.identityInjection.length / 4)
|
|
22029
|
+
});
|
|
22030
|
+
}
|
|
21988
22031
|
if (this.options.dynamicContext) {
|
|
21989
22032
|
sections.push({
|
|
21990
22033
|
label: "c_know",
|
|
@@ -54087,6 +54130,20 @@ function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce
|
|
|
54087
54130
|
const modelTier = getModelTier(config.model);
|
|
54088
54131
|
const projectCtx = buildProjectContext(repoRoot, taskStores?.contextStores);
|
|
54089
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
|
+
}
|
|
54090
54147
|
if (taskType && modelTier !== "small") {
|
|
54091
54148
|
dynamicContext += "\n\n" + buildTaskContext(taskType);
|
|
54092
54149
|
}
|
|
@@ -54199,6 +54256,29 @@ function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce
|
|
|
54199
54256
|
} catch {
|
|
54200
54257
|
}
|
|
54201
54258
|
const compactionThreshold = modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
|
|
54259
|
+
let identityInjection = "";
|
|
54260
|
+
try {
|
|
54261
|
+
const ikStateFile = join59(repoRoot, ".oa", "identity", "self-state.json");
|
|
54262
|
+
if (existsSync43(ikStateFile)) {
|
|
54263
|
+
const selfState = JSON.parse(readFileSync32(ikStateFile, "utf8"));
|
|
54264
|
+
const lines = [
|
|
54265
|
+
`[Identity State v${selfState.version}]`,
|
|
54266
|
+
`Self: ${selfState.narrative_summary}`,
|
|
54267
|
+
`Values: ${(selfState.values_stack || []).join(", ")}`,
|
|
54268
|
+
`Style: ${selfState.interaction_style?.tone || "collaborative"}, ${selfState.interaction_style?.depth_default || "balanced"} depth`
|
|
54269
|
+
];
|
|
54270
|
+
if (selfState.active_commitments?.length > 0)
|
|
54271
|
+
lines.push(`Commitments: ${selfState.active_commitments.join("; ")}`);
|
|
54272
|
+
if (selfState.active_goals?.length > 0)
|
|
54273
|
+
lines.push(`Goals: ${selfState.active_goals.join("; ")}`);
|
|
54274
|
+
const h = selfState.homeostasis;
|
|
54275
|
+
if (h && (h.uncertainty > 0.3 || h.coherence < 0.7 || h.goal_tension > 0.3)) {
|
|
54276
|
+
lines.push(`Homeostasis: uncertainty=${h.uncertainty.toFixed(1)} coherence=${h.coherence.toFixed(1)} tension=${h.goal_tension.toFixed(1)}`);
|
|
54277
|
+
}
|
|
54278
|
+
identityInjection = lines.join("\n");
|
|
54279
|
+
}
|
|
54280
|
+
} catch {
|
|
54281
|
+
}
|
|
54202
54282
|
const runner = new AgenticRunner(backend, {
|
|
54203
54283
|
maxTurns: 60,
|
|
54204
54284
|
maxTokens: 16384,
|
|
@@ -54217,7 +54297,8 @@ function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce
|
|
|
54217
54297
|
// effectively unlimited — no hard timeout, agent runs until complete or aborted
|
|
54218
54298
|
contextWindowSize: contextWindowSize ?? 0,
|
|
54219
54299
|
personality: personality ? getPreset(personality) : void 0,
|
|
54220
|
-
personalityName: personality ?? void 0
|
|
54300
|
+
personalityName: personality ?? void 0,
|
|
54301
|
+
identityInjection
|
|
54221
54302
|
});
|
|
54222
54303
|
runner.setWorkingDirectory(repoRoot);
|
|
54223
54304
|
const tools = buildTools(repoRoot, config, contextWindowSize);
|
package/package.json
CHANGED