claude-code-cache-fix 3.5.0 → 3.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-cache-fix",
3
- "version": "3.5.0",
3
+ "version": "3.5.1",
4
4
  "description": "Cache optimization proxy and interceptor for Claude Code. Fixes prompt cache bugs, stabilizes prefix, reduces quota burn.",
5
5
  "type": "module",
6
6
  "exports": "./preload.mjs",
@@ -151,6 +151,17 @@ export default {
151
151
  description: "Extract cache stats from response stream, persist quota state to ~/.claude/quota-status/{account.json,sessions/<filename>.json}",
152
152
  order: 600,
153
153
 
154
+ async onRequest(ctx) {
155
+ // Session-id headers (x-claude-code-session-id, etc.) live on the
156
+ // REQUEST, not the response — Anthropic doesn't echo them back. So we
157
+ // capture them here, in the request-side hook, and stash on ctx.meta
158
+ // for onStreamEvent to use when it writes the per-session file. The
159
+ // proxy server passes the same `meta` object through onRequest →
160
+ // onResponseStart → onStreamEvent, so this works end-to-end.
161
+ if (!ctx.headers) return;
162
+ ctx.meta._sessionId = resolveSessionId(ctx.headers);
163
+ },
164
+
154
165
  async onResponseStart(ctx) {
155
166
  if (!ctx.headers) return;
156
167
 
@@ -158,7 +169,6 @@ export default {
158
169
  if (!quota) return;
159
170
 
160
171
  ctx.meta._quotaData = quota;
161
- ctx.meta._sessionId = resolveSessionId(ctx.headers);
162
172
  },
163
173
 
164
174
  async onStreamEvent(ctx) {