@cognipeer/agent-sdk 0.5.4 → 0.6.1

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/README.md CHANGED
@@ -137,12 +137,8 @@ const agent = createSmartAgent({
137
137
  summarization: { summaryTriggerTokens: 8000, summaryMode: "incremental" },
138
138
  context: { policy: "hybrid", lastTurnsToKeep: 8 },
139
139
  toolResponses: {
140
- smallResponseChars: 1200,
141
- smallResponsePolicy: "keep_full",
142
- defaultPolicy: "keep_structured",
143
- largeResponsePolicy: "summarize_archive",
144
- fallbackPolicy: "keep_full",
145
- keepRecentFullCount: 2,
140
+ defaultPolicy: "summarize_archive",
141
+ toolResponseRetentionByTool: { read_skills: "keep_full" },
146
142
  maxToolResponseChars: 4000,
147
143
  maxToolResponseTokens: 1200,
148
144
  },
@@ -158,15 +154,13 @@ const result = await agent.invoke({
158
154
  console.log(result.content);
159
155
  ```
160
156
 
161
- Tool-response retention is size-aware and composable:
157
+ Tool-response retention is lazy and summarizer-driven:
162
158
 
163
- - `smallResponseChars` + `smallResponsePolicy` define how very small payloads are kept.
164
- - `defaultPolicy` handles normal informative outputs.
165
- - `largeResponsePolicy` handles verbose outputs that cross the max char/token thresholds.
166
- - `fallbackPolicy` applies to critical tools and now defaults to `keep_full` so safety-critical payloads are not collapsed accidentally.
167
- - `keepRecentFullCount` pins the last N successful tool responses at full content during context assembly and excludes them from summarization passes.
168
-
169
- Resolution order is: per-tool override, then critical fallback, then large/small classification, then the default policy. Redundant payloads like `ok`, `true`, and `null` are dropped automatically.
159
+ - Tool outputs are stored at full fidelity in `state.toolHistory` and are never reduced at tool-call time.
160
+ - When the summarizer runs (context limits reached), old tool messages are rewritten in place according to `defaultPolicy` (default: `summarize_archive`). The full payload is still recoverable via `get_tool_response` using the execution id embedded in the placeholder.
161
+ - `toolResponseRetentionByTool` lets you opt specific tools out of reduction (e.g. `read_skills: "keep_full"`).
162
+ - `criticalTools` are never reduced. The built-in list covers `response`, `manage_todo_list`, and `get_tool_response`.
163
+ - `maxToolResponseChars` / `maxToolResponseTokens` only drive an eager hard-cap truncation when a single tool output is big enough to blow up the very next model call. The truncated head always points at `get_tool_response` for recovery.
170
164
 
171
165
  The smart wrapper now supports runtime presets (`fast`, `balanced`, `deep`, `research`), custom profiles layered on top of a base preset, structured summarization, hybrid context compaction, configurable tool-response retention, in-memory fact storage, delegation limits, and an eval harness via `runSmartAgentEvalHarness(...)`.
172
166