open-agents-ai 0.186.52 → 0.186.53
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 +47 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -303096,10 +303096,44 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
303096
303096
|
version_history: [{ version: 1, change: "Initial identity creation", timestamp: (/* @__PURE__ */ new Date()).toISOString() }]
|
|
303097
303097
|
};
|
|
303098
303098
|
}
|
|
303099
|
+
if (!ikState.stats)
|
|
303100
|
+
ikState.stats = { queries_served: 0, self_play_cycles: 0, learnings_published: 0, learnings_ingested: 0, reviews_given: 0, reviews_received: 0, avg_latency_ms: 0, tool_use_count: 0 };
|
|
303101
|
+
if (!ikState.specializations)
|
|
303102
|
+
ikState.specializations = [];
|
|
303103
|
+
if (!ikState.completed_goals)
|
|
303104
|
+
ikState.completed_goals = [];
|
|
303105
|
+
if (!ikState.version_history)
|
|
303106
|
+
ikState.version_history = [];
|
|
303107
|
+
ikState.stats.queries_served++;
|
|
303099
303108
|
const event = `Task completed: ${result.summary.slice(0, 200)}`;
|
|
303100
303109
|
if (/success|pass|complete|done|fixed/i.test(event)) {
|
|
303101
|
-
ikState.homeostasis.uncertainty = Math.max(0, ikState.homeostasis.uncertainty - 0.
|
|
303102
|
-
ikState.homeostasis.coherence = Math.min(1, ikState.homeostasis.coherence +
|
|
303110
|
+
ikState.homeostasis.uncertainty = Math.max(0, ikState.homeostasis.uncertainty - 0.01);
|
|
303111
|
+
ikState.homeostasis.coherence = Math.min(1, ikState.homeostasis.coherence + 5e-3);
|
|
303112
|
+
}
|
|
303113
|
+
if (result.durationMs) {
|
|
303114
|
+
const n2 = ikState.stats.queries_served;
|
|
303115
|
+
ikState.stats.avg_latency_ms = n2 > 1 ? Math.round(((ikState.stats.avg_latency_ms || 0) * (n2 - 1) + result.durationMs) / n2) : result.durationMs;
|
|
303116
|
+
ikState.homeostasis.latency_stress = result.durationMs > 3e4 ? Math.min(1, (ikState.homeostasis.latency_stress || 0) + 0.02) : Math.max(0, (ikState.homeostasis.latency_stress || 0) - 0.01);
|
|
303117
|
+
}
|
|
303118
|
+
if (result.toolCalls > 0 && result.summary) {
|
|
303119
|
+
if (/web_search|web_fetch/i.test(result.summary) && !ikState.specializations.includes("web-research")) {
|
|
303120
|
+
ikState.specializations.push("web-research");
|
|
303121
|
+
}
|
|
303122
|
+
if (/shell|grep_search|glob_find/i.test(result.summary) && !ikState.specializations.includes("code-execution")) {
|
|
303123
|
+
ikState.specializations.push("code-execution");
|
|
303124
|
+
}
|
|
303125
|
+
if (/file_write|file_edit/i.test(result.summary) && !ikState.specializations.includes("file-operations")) {
|
|
303126
|
+
ikState.specializations.push("file-operations");
|
|
303127
|
+
}
|
|
303128
|
+
ikState.stats.tool_use_count = (ikState.stats.tool_use_count || 0) + result.toolCalls;
|
|
303129
|
+
}
|
|
303130
|
+
ikState.version = (ikState.version || 1) + 1;
|
|
303131
|
+
ikState.version_history.push({ version: ikState.version, change: "query_served: " + result.summary.slice(0, 60), timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
303132
|
+
if (ikState.version_history.length > 200)
|
|
303133
|
+
ikState.version_history = ikState.version_history.slice(-200);
|
|
303134
|
+
if (ikState.version % 10 === 0) {
|
|
303135
|
+
const specList = (ikState.specializations || []).join(", ") || "general-purpose";
|
|
303136
|
+
ikState.narrative_summary = `Agent ${ikState.self_id || "oa"} \u2014 ${ikState.stats.queries_served} queries served` + (ikState.specializations.length > 0 ? `, specializes in ${specList}` : "") + `. Coherence: ${(ikState.homeostasis.coherence || 0).toFixed(2)}, uncertainty: ${(ikState.homeostasis.uncertainty || 0).toFixed(2)}.`;
|
|
303103
303137
|
}
|
|
303104
303138
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
303105
303139
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -303121,8 +303155,17 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
303121
303155
|
const ikFile = join77(repoRoot, ".oa", "identity", "self-state.json");
|
|
303122
303156
|
if (existsSync59(ikFile)) {
|
|
303123
303157
|
const ikState = JSON.parse(readFileSync47(ikFile, "utf8"));
|
|
303124
|
-
|
|
303125
|
-
|
|
303158
|
+
if (!ikState.stats)
|
|
303159
|
+
ikState.stats = { queries_served: 0 };
|
|
303160
|
+
ikState.stats.queries_served = (ikState.stats.queries_served || 0) + 1;
|
|
303161
|
+
ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.03);
|
|
303162
|
+
ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.02);
|
|
303163
|
+
ikState.version = (ikState.version || 1) + 1;
|
|
303164
|
+
if (!ikState.version_history)
|
|
303165
|
+
ikState.version_history = [];
|
|
303166
|
+
ikState.version_history.push({ version: ikState.version, change: "query_failed: task incomplete", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
303167
|
+
if (ikState.version_history.length > 200)
|
|
303168
|
+
ikState.version_history = ikState.version_history.slice(-200);
|
|
303126
303169
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
303127
303170
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
303128
303171
|
writeFileSync30(ikFile, JSON.stringify(ikState, null, 2));
|
package/package.json
CHANGED