@tanstack/ai-compaction#
0.1.11#
Patch Changes#
- Updated dependencies [
37b2826,8e8ee26,c5c1996,3e30cde,0eb8f0b,f44b6b2,d632d41]:- @tanstack/ai@0.63.0
0.1.10#
Patch Changes#
- Updated dependencies [
a450d00,c54e20c,a56192e,740ae66,5099a32,820429f,0abae97,8c68c2d]:- @tanstack/ai@0.62.0
0.1.9#
Patch Changes#
0.1.8#
Patch Changes#
- Updated dependencies [
ef0a00f]:- @tanstack/ai@0.60.0
0.1.7#
Patch Changes#
0.1.6#
Patch Changes#
- Updated dependencies [
796f2b5]:- @tanstack/ai@0.58.0
0.1.5#
Patch Changes#
0.1.4#
Patch Changes#
0.1.3#
Patch Changes#
0.1.2#
Patch Changes#
0.1.1#
Patch Changes#
- Updated dependencies [
21775ee]:- @tanstack/ai@0.53.0
0.1.0#
Minor Changes#
#1235
e04ff6a- Add@tanstack/ai-compaction— context-window compaction as achat()middleware.withCompaction({ maxTokens, strategy })runs a pluggableCompactionStrategybefore each model call, so compaction is incremental and rolling. Three strategies ship built in:evictOldest(drop old messages, the default),summarizeOldest(replace them with an LLM summary), andclearToolResults(stub old tool output, keep the messages). Combine them withcomposeStrategies, which escalates through strategies until the transcript is back under budget. Strategies preserve tool-call/result pairing and never touch the system prompt.#1235
e04ff6a- Show compaction in TanStack AI DevTools.withCompactioninjectscompaction:started,compaction:state, andcompaction:endedCUSTOM stream events. State includes before/after counts, the token budget, and dropped vs sent message previews. The chat client re-emits the same three events. The AI panel has a Compaction tab and started/state/ended steps on the iteration.#1235
e04ff6a- Keep canonical chat history separate from compacted provider context. Reuse validated compaction checkpoints through an optional persistence metadata store.
Patch Changes#
- #1235
e04ff6a- Addctx.emitCustomEventon chat middleware context. The engine yieldsCUSTOMchunks while hooks such asonConfigare still running, so a long middleware step can send progress before it finishes. Compaction uses this to emitcompaction:startedbefore the strategy returns. - Updated dependencies [
49fc54c,e04ff6a,e04ff6a]:- @tanstack/ai@0.52.0