open-agents-ai 0.186.52 → 0.186.54
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 +48 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -303096,10 +303096,45 @@ 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) {
|
|
303119
|
+
const toolEvidence = result.summary || "";
|
|
303120
|
+
if (/web_search|web_fetch|searched|search.*web|fetched.*http|url/i.test(toolEvidence) && !ikState.specializations.includes("web-research")) {
|
|
303121
|
+
ikState.specializations.push("web-research");
|
|
303122
|
+
}
|
|
303123
|
+
if (/shell|grep_search|glob_find|executed.*command/i.test(toolEvidence) && !ikState.specializations.includes("code-execution")) {
|
|
303124
|
+
ikState.specializations.push("code-execution");
|
|
303125
|
+
}
|
|
303126
|
+
if (/file_write|file_edit|wrote.*file|edited.*file/i.test(toolEvidence) && !ikState.specializations.includes("file-operations")) {
|
|
303127
|
+
ikState.specializations.push("file-operations");
|
|
303128
|
+
}
|
|
303129
|
+
ikState.stats.tool_use_count = (ikState.stats.tool_use_count || 0) + result.toolCalls;
|
|
303130
|
+
}
|
|
303131
|
+
ikState.version = (ikState.version || 1) + 1;
|
|
303132
|
+
ikState.version_history.push({ version: ikState.version, change: "query_served: " + result.summary.slice(0, 60), timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
303133
|
+
if (ikState.version_history.length > 200)
|
|
303134
|
+
ikState.version_history = ikState.version_history.slice(-200);
|
|
303135
|
+
if (ikState.version % 10 === 0) {
|
|
303136
|
+
const specList = (ikState.specializations || []).join(", ") || "general-purpose";
|
|
303137
|
+
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
303138
|
}
|
|
303104
303139
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
303105
303140
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -303121,8 +303156,17 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
303121
303156
|
const ikFile = join77(repoRoot, ".oa", "identity", "self-state.json");
|
|
303122
303157
|
if (existsSync59(ikFile)) {
|
|
303123
303158
|
const ikState = JSON.parse(readFileSync47(ikFile, "utf8"));
|
|
303124
|
-
|
|
303125
|
-
|
|
303159
|
+
if (!ikState.stats)
|
|
303160
|
+
ikState.stats = { queries_served: 0 };
|
|
303161
|
+
ikState.stats.queries_served = (ikState.stats.queries_served || 0) + 1;
|
|
303162
|
+
ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.03);
|
|
303163
|
+
ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.02);
|
|
303164
|
+
ikState.version = (ikState.version || 1) + 1;
|
|
303165
|
+
if (!ikState.version_history)
|
|
303166
|
+
ikState.version_history = [];
|
|
303167
|
+
ikState.version_history.push({ version: ikState.version, change: "query_failed: task incomplete", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
303168
|
+
if (ikState.version_history.length > 200)
|
|
303169
|
+
ikState.version_history = ikState.version_history.slice(-200);
|
|
303126
303170
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
303127
303171
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
303128
303172
|
writeFileSync30(ikFile, JSON.stringify(ikState, null, 2));
|
package/package.json
CHANGED