Skip to content

Commit d645613

Browse files
author
SqlRush
committed
Accept GraphQL microcompact cache wrappers
1 parent f905b74 commit d645613

5 files changed

Lines changed: 20 additions & 1 deletion

File tree

docs/cc-100-roadmap.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ M6 补充:microcompact disk cache loader 的 `cached`/`fromCache`/`cacheHit`/`
4242

4343
M6 补充:microcompact disk cache loader 现在接受 JSON:API/resource-style `resource`/`attributes`/`properties` wrapper,summary payload 可放在 attributes/properties 内,外层 resource `id` 可作为 digest fallback。
4444

45+
M6 补充:microcompact disk cache loader 现在也递归解包 GraphQL-style `viewer`/`edge`/`node`/`attrs` wrapper,node `id` 可作为 digest fallback,attrs/properties 内的 summary、version、timestamp 和 TTL aliases 都会恢复。
46+
4547
M6 补充:microcompact disk cache loader 的 summary-like payload 现在接受 text content-block object、text content-block array 和 string array,会把可见 text block 合并为 summary,兼容官方/SDK 响应内容块形态的 cached microcompact 文件。
4648

4749
M6 补充:microcompact disk cache loader 的 summary-like payload 现在也接受完整 contract message object,并会递归解包 `message`/`assistantMessage`/`resultMessage`/`outputMessage`/`completionMessage` wrapper,从 message content 中恢复 visible text summary。
@@ -506,6 +508,8 @@ M7 补充:prompt history `LogEntry` 读取现在接受 `sessionID`/`session`/`
506508

507509
本轮补充:microcompact disk cache loader 现在会从 `metadata`/`meta`/`cacheInfo`/`cacheDetails`/`cacheEntry`/`entry`/`record`/`cache` 等 sidecar object 中补缺失的 digest、version、cache-hit、timestamp、TTL 和 count aliases;主 summary payload 字段仍保持优先。
508510

511+
本轮补充:microcompact disk cache loader 现在也递归解包 GraphQL-style `viewer`/`edge`/`node`/`attrs` wrapper,node `id` 可作为 digest fallback,attrs/properties 内的 summary、version、timestamp 和 TTL aliases 都会恢复。
512+
509513
本轮补充:microcompact disk cache loader 的 summary-like payload 现在接受 text content-block object、text content-block array 和 string array,会把可见 text block 合并为 summary,兼容官方/SDK 响应内容块形态的 cached microcompact 文件。
510514

511515
本轮补充:microcompact disk cache loader 的 summary-like payload 现在也接受完整 contract message object,并会递归解包 `message`/`assistantMessage`/`resultMessage`/`outputMessage`/`completionMessage` wrapper,从 message content 中恢复 visible text summary。

docs/claude-code-go-rewrite-plan.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ test/parity/ # golden tests against TS/official behavior
255255
- 本轮补充:microcompact disk cache loader 的 `cached`/`fromCache`/`cacheHit`/`isCached` 布尔字段现在接受 JSON bool、`true`/`false``yes`/`no``on`/`off``1`/`0` 数字/字符串形态。
256256
- 本轮补充:microcompact disk cache loader 现在会从 `metadata`/`meta`/`cacheInfo`/`cacheDetails`/`cacheEntry`/`entry`/`record`/`cache` 等 sidecar object 中补缺失的 digest、version、cache-hit、timestamp、TTL 和 count aliases;主 summary payload 字段仍保持优先。
257257
- 本轮补充:microcompact disk cache loader 现在也接受 JSON:API/resource-style `resource`/`attributes`/`properties` wrapper,summary payload 可放在 attributes/properties 内,外层 resource `id` 可作为 digest fallback。
258+
- 本轮补充:microcompact disk cache loader 现在也递归解包 GraphQL-style `viewer`/`edge`/`node`/`attrs` wrapper,node `id` 可作为 digest fallback,attrs/properties 内的 summary、version、timestamp 和 TTL aliases 都会恢复。
258259
- 本轮补充:microcompact disk cache loader 的 summary-like payload 现在接受 text content-block object、text content-block array 和 string array,会把可见 text block 合并为 summary,兼容官方/SDK 响应内容块形态的 cached microcompact 文件。
259260
- 本轮补充:microcompact disk cache loader 的 summary-like payload 现在也接受完整 contract message object,并会递归解包 `message`/`assistantMessage`/`resultMessage`/`outputMessage`/`completionMessage` wrapper,从 message content 中恢复 visible text summary。
260261
- 本轮补充:microcompact disk cache loader 的 summary array 元素现在也接受完整 contract message object,可把 message list 与 content-block 混合数组恢复成可见摘要文本。

docs/first-second-parity-audit.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ M6 progress now includes:
130130
- `internal/compact`: microcompact disk cache loading and pruning now use the `<digest>.json` filename as a digest fallback when a cache entry omits an internal digest, while preserving explicit digest mismatch pruning/errors.
131131
- `internal/compact`: microcompact disk cache loading now accepts non-strict cache-hit booleans for `cached`/`fromCache`/`cacheHit`/`isCached`, including `yes`/`no`, `on`/`off`, and `1`/`0` JSON number or string values.
132132
- `internal/compact`: microcompact disk cache loading now accepts JSON:API/resource-style `resource`/`attributes`/`properties` wrappers, with summary payloads inside attributes/properties and outer resource IDs used as digest fallback when needed.
133+
- `internal/compact`: microcompact disk cache loading now also recurses through GraphQL-style `viewer`/`edge`/`node`/`attrs` wrappers, preserving node IDs as digest fallback while recovering summary, version, timestamp, and TTL aliases.
133134
- `internal/compact`: microcompact disk cache summary payloads now accept text content-block objects, text content-block arrays, and string arrays, joining visible text blocks into the recovered summary for official/SDK-style cached microcompact files.
134135
- `internal/compact`: microcompact disk cache summary payloads now also accept full contract message objects and unwrap `message`/`assistantMessage`/`resultMessage`/`outputMessage`/`completionMessage` response wrappers before extracting visible text summary.
135136
- `internal/compact`: microcompact disk cache summary arrays now also accept full contract message objects mixed with content blocks, extracting visible message text while skipping non-visible blocks.

internal/compact/compact_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,18 @@ func TestLoadMicroResultAcceptsWrappedCacheObjects(t *testing.T) {
424424
want: "properties summary",
425425
wantExpires: true,
426426
},
427+
{
428+
digest: "graphql-edge-attrs",
429+
body: `"edge":{"node":{"id":"graphql-edge-attrs","attrs":{"summaryMarkdown":"edge attrs summary","formatVersion":"microcompact.v1","cachedAt":100,"ttlSeconds":3600}}}`,
430+
want: "edge attrs summary",
431+
wantExpires: true,
432+
},
433+
{
434+
digest: "graphql-viewer-node",
435+
body: `"data":{"viewer":{"node":{"id":"graphql-viewer-node","properties":{"compressedText":"viewer node summary","cacheVersion":"microcompact.v1","generatedAt":100,"maxAgeMilliseconds":3600000}}}}`,
436+
want: "viewer node summary",
437+
wantExpires: true,
438+
},
427439
{
428440
digest: "wrapped-envelope",
429441
body: `"data":{"summary":"envelope summary"},"digest":"wrapped-envelope","version":"microcompact.v1","createdAt":100,"ttlSeconds":3600`,

internal/compact/micro.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,10 @@ func microResultWrappedJSON(fields map[string]json.RawMessage) (json.RawMessage,
189189
}
190190
for _, name := range []string{
191191
"result", "data", "cache", "cacheEntry", "cache_entry", "entry", "record", "item", "resource", "payload", "response", "body",
192+
"viewer", "edge", "node",
192193
"microcompact", "microCompact", "micro_compact", "micro_result", "microResult", "microcompactResult", "microCompactResult", "micro_compact_result",
193194
"message", "assistantMessage", "assistant_message", "resultMessage", "result_message", "outputMessage", "output_message", "completion", "completionMessage", "completion_message",
194-
"attributes", "properties", "value",
195+
"attributes", "properties", "attrs", "value",
195196
} {
196197
raw, ok := fields[name]
197198
if !ok {

0 commit comments

Comments
 (0)