@benkhz/context-manager 2.0.1 → 2.0.2
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/package.json +1 -1
- package/src/AIContextManager.js +5 -1
package/package.json
CHANGED
package/src/AIContextManager.js
CHANGED
|
@@ -328,7 +328,11 @@ export class AIContextManager {
|
|
|
328
328
|
|
|
329
329
|
/** Approximate context size in characters, measured on the active LLM-facing window */
|
|
330
330
|
_charCount() {
|
|
331
|
-
return this._activeMessages.reduce((n, m) =>
|
|
331
|
+
return this._activeMessages.reduce((n, m) => {
|
|
332
|
+
const contentLen = m.content?.length ?? 0
|
|
333
|
+
const toolCallsLen = m.toolCalls ? JSON.stringify(m.toolCalls).length : 0
|
|
334
|
+
return n + contentLen + toolCallsLen
|
|
335
|
+
}, 0)
|
|
332
336
|
}
|
|
333
337
|
|
|
334
338
|
/** Hard truncation — drop oldest active messages down to compactKeepLast (no summary kept) */
|