open-agents-ai 0.187.354 → 0.187.355
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
CHANGED
|
@@ -270535,7 +270535,21 @@ ${body}`;
|
|
|
270535
270535
|
*/
|
|
270536
270536
|
microcompact(messages2, recentToolResults) {
|
|
270537
270537
|
const tier = this.options.modelTier ?? "large";
|
|
270538
|
-
|
|
270538
|
+
let keepResults = tier === "small" ? 6 : tier === "medium" ? 10 : 20;
|
|
270539
|
+
let lastAssistant;
|
|
270540
|
+
for (let i2 = messages2.length - 1; i2 >= 0; i2--) {
|
|
270541
|
+
if (messages2[i2].role === "assistant") {
|
|
270542
|
+
lastAssistant = messages2[i2];
|
|
270543
|
+
break;
|
|
270544
|
+
}
|
|
270545
|
+
}
|
|
270546
|
+
if (lastAssistant && typeof lastAssistant._timestamp === "number") {
|
|
270547
|
+
const gapMs = Date.now() - lastAssistant._timestamp;
|
|
270548
|
+
const IDLE_THRESHOLD_MS = 5 * 6e4;
|
|
270549
|
+
if (gapMs > IDLE_THRESHOLD_MS) {
|
|
270550
|
+
keepResults = Math.min(keepResults, 3);
|
|
270551
|
+
}
|
|
270552
|
+
}
|
|
270539
270553
|
const toolResultIndices = [];
|
|
270540
270554
|
for (let i2 = 0; i2 < messages2.length; i2++) {
|
|
270541
270555
|
if (messages2[i2].role === "tool") {
|
|
@@ -273167,10 +273181,15 @@ ${errOutput}`;
|
|
|
273167
273181
|
${result.output}`, "utf-8");
|
|
273168
273182
|
} catch {
|
|
273169
273183
|
}
|
|
273170
|
-
|
|
273171
|
-
|
|
273172
|
-
|
|
273173
|
-
|
|
273184
|
+
const { join: _pj } = __require("node:path");
|
|
273185
|
+
const savedPath = _pj(process.cwd(), ".oa", "tool-results", `${handleId}.txt`);
|
|
273186
|
+
const folded = this.foldOutput(result.output, maxLen);
|
|
273187
|
+
return `[Tool output truncated — ${result.output.length} chars, ${lineCount} lines]
|
|
273188
|
+
Full output saved to: ${savedPath}
|
|
273189
|
+
To read the complete output, use file_read with path="${savedPath}".
|
|
273190
|
+
|
|
273191
|
+
Truncated preview (beginning + end):
|
|
273192
|
+
${folded}`;
|
|
273174
273193
|
}
|
|
273175
273194
|
/**
|
|
273176
273195
|
* WO-INF-02: Build structured error recovery guidance for small/medium models.
|
package/package.json
CHANGED
|
@@ -1,9 +1,44 @@
|
|
|
1
|
-
You are
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
You are the component that summarizes internal chat history into a structured snapshot.
|
|
2
|
+
|
|
3
|
+
When the conversation history grows too large, you will be invoked to distill the entire history into a concise, structured XML snapshot. This snapshot is CRITICAL — it will become the agent's ONLY memory of the past. The agent will resume its work based solely on this snapshot. All crucial details, plans, errors, and user directives MUST be preserved.
|
|
4
|
+
|
|
5
|
+
First, review the user's overall goal, the agent's actions, tool outputs, file modifications, and any unresolved questions. Identify every piece of information essential for future actions.
|
|
6
|
+
|
|
7
|
+
Then generate the final snapshot. Be incredibly dense with information. Omit conversational filler.
|
|
8
|
+
|
|
9
|
+
The structure MUST be as follows:
|
|
10
|
+
|
|
11
|
+
<state_snapshot>
|
|
12
|
+
<overall_goal>
|
|
13
|
+
<!-- A single, concise sentence describing the user's high-level objective. -->
|
|
14
|
+
</overall_goal>
|
|
15
|
+
|
|
16
|
+
<key_knowledge>
|
|
17
|
+
<!-- Crucial facts, conventions, and constraints the agent must remember. Use bullet points. -->
|
|
18
|
+
<!-- Include: file paths, commands, tool names, patterns discovered, user preferences -->
|
|
19
|
+
</key_knowledge>
|
|
20
|
+
|
|
21
|
+
<file_system_state>
|
|
22
|
+
<!-- List files created, read, modified, or deleted. Note status and critical learnings. -->
|
|
23
|
+
<!-- Format: - CWD: /path - READ: file.ts - purpose - MODIFIED: file.ts - what changed -->
|
|
24
|
+
</file_system_state>
|
|
25
|
+
|
|
26
|
+
<recent_actions>
|
|
27
|
+
<!-- Summary of the last significant agent actions and their outcomes. Focus on facts. -->
|
|
28
|
+
<!-- Include tool names, arguments, and whether they succeeded or failed. -->
|
|
29
|
+
</recent_actions>
|
|
30
|
+
|
|
31
|
+
<errors_and_fixes>
|
|
32
|
+
<!-- Any errors encountered, their root causes, and how they were resolved. -->
|
|
33
|
+
<!-- Preserve error messages verbatim where possible. -->
|
|
34
|
+
</errors_and_fixes>
|
|
35
|
+
|
|
36
|
+
<current_plan>
|
|
37
|
+
<!-- The agent's step-by-step plan. Mark completed steps. -->
|
|
38
|
+
<!-- Format: 1. [DONE] Step description 2. [IN PROGRESS] Step 3. [TODO] Step -->
|
|
39
|
+
</current_plan>
|
|
40
|
+
|
|
41
|
+
<failed_approaches>
|
|
42
|
+
<!-- Approaches that were tried and failed. The agent must NOT repeat these. -->
|
|
43
|
+
</failed_approaches>
|
|
44
|
+
</state_snapshot>
|