Files
plugins/packages/fovea/package.json
T
Howie 1e9f14248e fovea 0.2.3: a forged marker no longer exempts old content from cutting (#755)
cut() skipped any text containing "[fovea:" as already cut. That string
can come from a tool result, a file read or a user message, so such a
block stayed whole forever. The sniff is removed; the existing
head + tail + 80 length guard keeps a cut result from being cut again,
since the marker adds at most 44 chars plus the count's digits.
cut() is the one place the cut marker was read, and every route goes through
it: Chat role:"tool" (string and text parts), Anthropic tool_result
(string and nested text parts) and text blocks, Responses
function_call_output / custom_tool_call_output and message parts, and
user/assistant text. Saccade mode compares against the exact NOTE line
only, so it was not affected.

Reviewed head c41cae5cb43770158173369f18acda4e572fdc9e (evanmaranzano),
run on mote (Bun 1.4.2, HOME a temp dir):
- bun test packages/fovea: 35 pass, 0 fail, 128 expects.
- bun scripts/check.mjs: ok.
- A review-only property check, 12000 requests over Chat, Anthropic and
  Responses shapes (string and nested-part tool results, text blocks),
  random head/tail options and lengths, a forged "[fovea: ...]" at a
  random offset, emoji at the end: 0 second-pass differences, 0 forged
  blocks over the bound left whole.
- Broken by hand: putting the includes("[fovea:") line back in
  fovea.middleware.js and page/measure.js turns the new case and the new
  test red (33 pass, 2 fail) and the property check reports 38492
  forged blocks left whole.

Not changed here: state_marker (opt-in, default "") is still found in any
item's text, a Chat tool result's included: #756. Not tried:
magpie's moejs run of cases.json, and a live gateway request.
2026-11-05 15:12:57 +08:00

64 lines
2.2 KiB
JSON

{
"name": "@magpie-community/middleware-fovea",
"version": "0.2.3",
"description": "magpie gateway middleware: keep the recent window sharp, thin old history to head and tail, and on a saccade drop the old context on a new topic — with an evidence page",
"type": "module",
"files": [
"CHANGELOG.md",
"LICENSE",
"README.md",
"benchmark.mjs",
"build.mjs",
"cases.json",
"fovea.middleware.js",
"fovea.test.mjs",
"page/*",
"preview.mjs",
"state-block.example.json"
],
"keywords": [
"magpie",
"magpie-middleware",
"context",
"history",
"compaction",
"tool-results",
"token-budget",
"saccade",
"llm-gateway"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/magpie-community/plugins.git",
"directory": "packages/fovea"
},
"magpie": {
"middleware": "./fovea.middleware.js",
"page": {
"title": "Fovea evidence",
"titles": {
"zh": "Fovea 对照证据"
},
"file": "page/index.html",
"icon": "page/icon.svg"
},
"permissions": [],
"options": {
"threshold": 96000,
"keep_recent": 12,
"keep_recent_tokens": 16000,
"tool_head": 600,
"tool_tail": 300,
"text_head": 1200,
"text_tail": 400,
"drop_old_images": true,
"protect": [],
"saccade": "off",
"state_marker": "",
"cut_step": 24
},
"icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4IiByb2xlPSJpbWciIGFyaWEtbGFiZWw9IkZvdmVhIGxvZ28gZm9yIGRhcmsgYmFja2dyb3VuZHMiPgogIDx0aXRsZT5Gb3ZlYSDigJQgc2hhcnAgY2VudHJlLCBmYWRpbmcgcGVyaXBoZXJ5IChkYXJrKTwvdGl0bGU+CiAgPGNpcmNsZSBjeD0iNjQiIGN5PSI2NCIgcj0iNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2U4ZWVmNSIgc3Ryb2tlLW9wYWNpdHk9IjAuMjIiIHN0cm9rZS13aWR0aD0iNiIvPgogIDxjaXJjbGUgY3g9IjY0IiBjeT0iNjQiIHI9IjQyIiBmaWxsPSJub25lIiBzdHJva2U9IiNlOGVlZjUiIHN0cm9rZS1vcGFjaXR5PSIwLjUiIHN0cm9rZS13aWR0aD0iNyIvPgogIDxjaXJjbGUgY3g9IjY0IiBjeT0iNjQiIHI9IjI1IiBmaWxsPSJub25lIiBzdHJva2U9IiNlOGVlZjUiIHN0cm9rZS1vcGFjaXR5PSIwLjkiIHN0cm9rZS13aWR0aD0iOCIvPgogIDxjaXJjbGUgY3g9IjY0IiBjeT0iNjQiIHI9IjEwIiBmaWxsPSIjOGRiYmY1Ii8+Cjwvc3ZnPgo="
}
}