Skip to content

Commit 6b1c46a

Browse files
author
SqlRush
committed
Accept resource interaction script wrappers
1 parent dd34966 commit 6b1c46a

5 files changed

Lines changed: 15 additions & 0 deletions

File tree

docs/cc-100-roadmap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,8 @@ M7 补充:prompt history `LogEntry` 读取现在接受 `sessionID`/`session`/`
564564

565565
本轮补充:interaction script loader 现在接受 `data`/`payload`/`body`/`result`/`response`/`recording`/`session`/`run` 等外层对象 wrapper,可继续递归查找 steps/records/events/timeline。
566566

567+
本轮补充:interaction script loader 现在也接受 JSON:API/resource-style `resource`/`attributes`/`properties` wrapper,可从 attributes/properties 内继续解析 `steps`/`records`/`timeline`
568+
567569
本轮补充:prompt/image history 的 `ImageDimensions` 读取 `width`/`height` 或仅 original 尺寸时,会默认 display 尺寸等于 original 尺寸,避免只有单尺寸字段的 image fixture 丢失 source metadata。
568570

569571
本轮补充:prompt history 的 pasted-content 类型现在会归一化 `inputImage`/`pasted-image`/`input_text`/`pasted-text` 等别名,runtime history 和 stored history 恢复都会映射到规范 `image`/`text`

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ test/parity/ # golden tests against TS/official behavior
365365
- 本轮补充:interaction script 批量消息注入接受 `messages``append_messages`/`appendMessages``transcript_messages`/`transcriptMessages` 字段,且这些字段可用单对象或对象数组,复用 chat/transcript role/text 别名;message 注入也接受 `pastedContent`/`attachments` 粘贴内容别名、单数 `imagePasteId` 图片引用别名,以及 pasted-content 的 `kind`/`value`/`data` 内容字段别名。
366366
- 本轮补充:interaction script direct `dialog` step 接受 `dialogId`/`dialogKind``heading`/`header``content`/`text`/`message``options`/`choices`/`buttons``focusedIndex`/`selectedIndex` 等字段别名,且 actions/options 可用单字符串。
367367
- 本轮补充:interaction script loader 接受 `scriptSteps`/`script_steps``interactionSteps`/`interaction_steps` wrapper 字段,并支持一层 `scenario`/`test`/`case`/`fixture`/`interaction` 嵌套对象。
368+
- 本轮补充:interaction script loader 现在也接受 JSON:API/resource-style `resource`/`attributes`/`properties` wrapper,可从 attributes/properties 内继续解析 `steps`/`records`/`timeline`,减少官方 fixture API envelope 的改写成本。
368369
- 本轮补充:ANSI snapshot corpus 比对支持 `.ansi` only baseline fallback,strict stale-baseline 检查同时覆盖 `.txt``.ansi`
369370
- 本轮补充:interaction script JSONL loader 单行上限提升到 50MiB,和 transcript/session 大记录读取容忍度对齐,覆盖大型 paste、image metadata 或 snapshot fixture 脚本行。
370371
- 本轮补充:terminal lifecycle 增加可选 extended-key mode,按官方 `CSI >1u`/`CSI >4;2m` 启用 kitty keyboard protocol 和 modifyOtherKeys,退出时重置 modifyOtherKeys 并 pop kitty stack,reassert 时先 pop 再 push 以避免长期会话 stack 泄漏。

docs/first-second-parity-audit.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ M7 progress now includes:
350350
- `internal/tui`: interaction script single-step JSON now unwraps `step`/`scriptStep`/`interactionStep`/`record`/`entry`/`item`/`event` objects in arrays, JSONL records, and wrapper-object step lists.
351351
- `internal/tui`: interaction script top-level wrappers now accept record-array aliases such as `records`/`recordedSteps`/`events`/`entries`/`items`/`actions`/`timeline`.
352352
- `internal/tui`: interaction script loading now recurses through outer API/fixture wrappers such as `data`/`payload`/`body`/`result`/`response`/`recording`/`session`/`run`.
353+
- `internal/tui`: interaction script loading now also recurses through JSON:API/resource-style `resource`/`attributes`/`properties` wrappers, so API envelopes can expose `steps`/`records`/`timeline` without manual flattening.
353354
- `internal/contracts`/`internal/session`: remote history `SDKEvent` message extraction now recurses through nested payload wrappers such as `record`/`entry`/`item`/`event`/`result`/`response`/`output`.
354355
- `internal/session`: remote-history event arrays now unwrap element-level wrappers such as `event`/`record`/`entry`/`item`/`resource`/`value` and wrapper-only `data`/`payload`/`body`, using element cursors as event ID fallback outside GraphQL edges.
355356
- `internal/session`: remote-history event arrays now accept JSON:API/resource-style elements with event payloads inside `attributes` or `properties`, preserving the outer resource `id` as the SDK event ID fallback.

internal/tui/script_loader.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ func parseInteractionScriptObject(data []byte) ([]ScriptStep, bool, error) {
105105
"body",
106106
"result",
107107
"response",
108+
"resource",
109+
"attributes",
110+
"properties",
108111
"recording",
109112
"session",
110113
"run",

internal/tui/tui_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6379,6 +6379,14 @@ func TestParseInteractionScriptAcceptsNestedRecordArrayWrappers(t *testing.T) {
63796379
{"action":"type","value":"ship"},
63806380
{"type":"press","value":"enter","expectEvent":{"type":"prompt_submitted","value":"ship"}}
63816381
]}}`,
6382+
"resource_attributes": `{"id":"fixture_1","type":"interaction-script","attributes":{"steps":[
6383+
{"action":"type","value":"plan"},
6384+
{"type":"press","value":"enter","expectEvent":{"type":"prompt_submitted","value":"plan"}}
6385+
]}}`,
6386+
"resource_properties": `{"resource":{"id":"fixture_2","type":"interaction-script","properties":{"timeline":[
6387+
{"action":"type","value":"audit"},
6388+
{"type":"press","value":"enter","expectEvent":{"type":"prompt_submitted","value":"audit"}}
6389+
]}}}`,
63826390
"response_fixture": `{"response":{"fixture":{"steps":[
63836391
{"action":"type","value":"test"},
63846392
{"type":"press","value":"enter","expectEvent":{"type":"prompt_submitted","value":"test"}}

0 commit comments

Comments
 (0)