Files
plugins/packages/history-trim/package.json
T
Mañjūṣaka ebdd4fd247 history-trim 0.1.1: declare compressToolResults and preserveSystemPrompt, two regression cases (manjughosa, #681)
Declares history-trim's existing compressToolResults (true) and
preserveSystemPrompt (false) options in the package manifest, matching what
history-trim.middleware.js does when they are absent, and adds two
regression cases: a long surrogate-only tool result in the turn being sent
stays whole, and a repeated message is dropped even when its keys are in a
different order. No middleware runtime change. Version 0.1.0 -> 0.1.1 so
the new manifest is packed onto dist.

Run at the reviewed head 06c179d (and merged onto main d9a6c45), on mote:
- bun test packages/history-trim: 23 pass, 0 fail
- bun scripts/check.mjs: exit 0; bun test scripts/: 0 fail
Broken by hand: turning off the `index >= currentTurnStart` guard in
cutToolResults fails the new surrogate case (and "the turn being sent is
never cut"); dropping .sort() in canonical() fails the key-order case.
Not tried: a real request through a magpie gateway with the middleware on.
2026-11-04 19:08:41 +08:00

18 lines
879 B
JSON

{
"name": "@magpie-community/middleware-history-trim",
"version": "0.1.1",
"description": "Send a request's history smaller: blank-line runs folded, a system prompt written twice and a message repeated right after itself dropped, a past tool result longer than maxToolLength cut, as magpie gateway middleware",
"type": "module",
"files": ["history-trim.middleware.js", "README.md", "LICENSE", "PROVENANCE.json"],
"keywords": ["magpie", "magpie-middleware", "compression", "context", "history", "tokens", "llm-gateway"],
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/history-trim" },
"magpie": {
"middleware": "./history-trim.middleware.js",
"options": {
"maxToolLength": 2000,
"compressToolResults": true,
"preserveSystemPrompt": false
}
}
}