feat: cache hit observability, configurable TTL, optimized marker stripping#2
Open
binhex wants to merge 9 commits into
Open
feat: cache hit observability, configurable TTL, optimized marker stripping#2binhex wants to merge 9 commits into
binhex wants to merge 9 commits into
Conversation
…rker stripping Three improvements to the opencode-go cache extension: - Cache hit observability: message_end hook parses assistant message usage and shows cumulative cache hit percentage in TUI footer (e.g. 'opencode-go-cache: 87%') - Configurable TTL: PI_OPENCODE_CACHE_TTL env var replaces hardcoded 1h default. Supports values like '30m', '2h', '0'/'off' to omit ttl. - Optimized marker stripping: replaced recursive tree walk with non-recursive targeted clear at known marker surfaces, including nested tool_result content. Version bumped to 0.4.0. QA configs (eslint, prettier, pre-commit) auto-generated.
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.
What's Changed
Three improvements to the opencode-go cache extension (v0.4.0):
📊 Cache hit observability (TUI footer)
message_endhook parses Pi's normalizedusageto extract cache hit dataCU) and turn-based (TB) cache hit percentages(e.g.
opencode-go-cache: CU98% TB100%)how much of the latest response came from cache
cacheRead > 0confirmed⚙️ Configurable TTL (
PI_OPENCODE_CACHE_TTL)"1h"default"30m","2h", or"0"/"off"to omit ttl entirely"1h""0h","00m")⚡ Optimized marker stripping
tool_resultcontent clearing for round-tripped markers🌐 OpenCode Zen support
"opencode-go"to["opencode-go", "opencode-zen"]Other