Repository navigation
feat(pruner,proxy,router): adaptive token-budget stream filter, Streamable HTTP & multi-upstream gateway (v1.2.0) - #4
Merged
Conversation
…8 slicing and framing bounds
…or and adaptive stream filter
…io parse recovery, and SSE/HTTP security
… meta-tools, and dynamic hydration
…llers, and release pipeline
…te, and v1.2.0 docs
…d scope active window to dynamic tier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1
Summary
Implements ToolPrune v1.2.0, delivering RFC #1 (
--max-schema-tokensprogressive token-budget compactor and adaptive context-aware stream filter), modern MCP schema fidelity, multi-upstream gateway routing (Stdio + SSE + Streamable HTTP/mcp), localhost DNS-rebinding security hardening, CLI enhancements, and cross-platform E2E + benchmark verification.Key Architectural Upgrades
pkg/pruner/budget.go): 5-pass deterministic compaction engine (minify -> condense -> aggressive -> signature skeleton -> priority-scored stubbing) calibrated againstcl100k_basetokenization to strictly enforce--max-schema-tokens=N(pruning.max_schema_tokens).pkg/proxy/stream_filter.go): Interceptstools/listandtools/callon the live wire with hot-tool usage scoring (2xpriority boost for active tools), SHA-256(upstream_hash, hot_set, budget)cache (0.0037mscache hit,0.353mscold pass), and pre-bind JSON Schema validation against the unpruned upstream contract (0.010ms).pkg/mcp,pkg/pruner): PreservesoutputSchema,annotations,title,$defs/definitions/$ref,const,pattern,format,items,oneOf/anyOf/allOf, and rune-safe UTF-8 sentence condensation; raises framing limit to 16MB for bothContent-Lengthand NDJSON streams.pkg/router,pkg/proxy/sse.go,pkg/proxy/sse_client.go): Wires multi-upstream configuration into live gateway execution (toolprune_search_tools/toolprune_call_toolmeta-tools + dynamic hydration), adds outbound SSE client and Streamable HTTP/mcp, fixes supervisor pipe/data races, and enforcesHost+OriginDNS-rebinding defenses on loopback HTTP listeners.--preset(minimal/balanced/strict/dynamic),routes --profile/--filter,bench --csv/--verbose,config patch-claude, SHA-256 verified installers (install.sh/install.ps1), andwindows/arm64release artifacts.Benchmarks & Verification (
Go 1.23,CGO_ENABLED=0)cl100k_base):3,596raw tokens ->242tokens under--max-schema-tokens=350(-93.3%) and127tokens in Tier 4dynamic(-96.5%).go vet ./...clean; 198 top-level test functions passing across all 11 Go packages.