opencode-cache-engine 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Provider-aware prompt-cache optimization and observability for [OpenCode](https:
|
|
|
6
6
|
|
|
7
7
|
The plugin currently has three cache-policy families:
|
|
8
8
|
|
|
9
|
-
* **DeepSeek V4 Flash** — passive cache-stability and observability
|
|
9
|
+
* **DeepSeek V4.1 Flash** — passive cache-stability and observability
|
|
10
10
|
* **GPT-5.6 Luna** — active cache-control configuration
|
|
11
11
|
* **GLM-5.3 Flash** — conservative system-prompt stabilization
|
|
12
12
|
|
|
@@ -37,7 +37,7 @@ The plugin deliberately avoids pretending that a local hash is proof of a provid
|
|
|
37
37
|
|
|
38
38
|
# Provider behavior
|
|
39
39
|
|
|
40
|
-
## DeepSeek V4 Flash
|
|
40
|
+
## DeepSeek V4.1 Flash
|
|
41
41
|
|
|
42
42
|
### Policy: passive
|
|
43
43
|
|
|
@@ -227,7 +227,7 @@ The plugin uses three different strategies because cache mechanisms differ by pr
|
|
|
227
227
|
|
|
228
228
|
| Provider | Prompt text changed? | Cache metadata changed? | Main strategy |
|
|
229
229
|
| ----------------- | -------------------: | ----------------------: | --------------------------------- |
|
|
230
|
-
| DeepSeek V4 Flash | No | No | Preserve stable harness + observe |
|
|
230
|
+
| DeepSeek V4.1 Flash | No | No | Preserve stable harness + observe |
|
|
231
231
|
| GPT-5.6 Luna | No | Yes | Stable cache key + cache options |
|
|
232
232
|
| GLM-5.3 Flash | Yes, narrowly | No provider cache key | Isolate volatile system content |
|
|
233
233
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-cache-engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Provider-aware prompt-cache optimization and telemetry for OpenCode",
|
|
6
6
|
"keywords": [
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
"test": "test"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
|
-
"test": "node --test test/cache-engine.test.mjs"
|
|
31
|
+
"test": "node --test test/cache-engine.test.mjs",
|
|
32
|
+
"postpublish": "VERSION=$(node -p \"require('./package').version\") && TAG=v$VERSION && echo \"Creating git tag $TAG for npm $VERSION\" && git tag $TAG && git push origin $TAG || echo \"Tag $TAG may already exist or push failed; continuing.\"",
|
|
33
|
+
"updateGit": "npm uninstall PACKAGE-NAME && npm install git+https://github.com/username/repo.git"
|
|
32
34
|
}
|
|
33
35
|
}
|
package/src/cache-engine.ts
CHANGED
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
// Provider-aware prompt-cache observability + conservative cache-shape
|
|
40
40
|
// preservation for ONE OpenCode TUI across three model families:
|
|
41
41
|
//
|
|
42
|
-
// DeepSeek V4 Flash -> pure passive. >99.66% hit rate is preserved by never
|
|
42
|
+
// DeepSeek V4.1 Flash -> pure passive. >99.66% hit rate is preserved by never
|
|
43
43
|
// mutating system/options/requests. Observability only.
|
|
44
44
|
// GPT-5.6 Luna -> ACTIVE cache-control: a stable session-derived
|
|
45
45
|
// prompt_cache_key + prompt_cache_options (implicit,
|
|
@@ -180,7 +180,7 @@ test("disabled engine -> enabled=false", () => {
|
|
|
180
180
|
|
|
181
181
|
test("malformed config falls back to defaults", () => {
|
|
182
182
|
const dir = mkdtempSync(join(tmpdir(), "ce-"))
|
|
183
|
-
const bad = join(dir, "
|
|
183
|
+
const bad = join(dir, "cache-engine.json")
|
|
184
184
|
writeFileSync(bad, "{ this is not json")
|
|
185
185
|
const cfg = loadConfig({ configPath: bad, env: {} })
|
|
186
186
|
assert.equal(cfg.enabled, true)
|
|
@@ -227,8 +227,8 @@ test("recorder writes valid JSONL to a real file", () => {
|
|
|
227
227
|
|
|
228
228
|
const M = (providerID, modelID, extra = {}) => ({ providerID, modelID, ...extra })
|
|
229
229
|
|
|
230
|
-
test("DeepSeek V4 Flash matches DeepSeek policy (openrouter + direct)", () => {
|
|
231
|
-
assert.equal(detectPolicy(M("openrouter", "deepseek/deepseek-v4-flash-0731")), POLICY_DEEPSEEK)
|
|
230
|
+
test("DeepSeek V4.1 Flash matches DeepSeek policy (openrouter + direct)", () => {
|
|
231
|
+
assert.equal(detectPolicy(M("openrouter", "deepseek/deepseek-v4.1-flash-0731")), POLICY_DEEPSEEK)
|
|
232
232
|
assert.equal(detectPolicy(M("deepseek", "deepseek-chat")), POLICY_DEEPSEEK)
|
|
233
233
|
})
|
|
234
234
|
|
|
@@ -602,7 +602,7 @@ test("glmHitRatio uses cached over total prompt tokens", () => {
|
|
|
602
602
|
// GPT-5.6 cache-root derivation (pure)
|
|
603
603
|
// ===========================================================================
|
|
604
604
|
|
|
605
|
-
import { gptCacheKeyFor, observeReasoningEffort, prefixChangeReasons, reasoningEffortFromOptions, reasoningIssueReasons, resolveCacheRootSync } from "
|
|
605
|
+
import { gptCacheKeyFor, observeReasoningEffort, prefixChangeReasons, reasoningEffortFromOptions, reasoningIssueReasons, resolveCacheRootSync } from "../src/cache-engine-core.mjs"
|
|
606
606
|
|
|
607
607
|
const parents = (m) => (id) => m[id] ?? null
|
|
608
608
|
|
|
Binary file
|