feat(protocol): wire contract, canonical reducer and golden fixtures

- v1 envelope across browser/daemon/plugin
- SessionState model + reducer rules (pi events + pi2:* derived events)
- fixtures for basic turn, queue/todo/attention and abort/exit
- 9 conformance tests pinning the reducer
This commit is contained in:
yuez committed 2026-10-21 10:58:46 +08:00
commit 9d817f35b7
19 files changed
+2922

No files matched your search

@@ -0,0 +1,11 @@
{"type":"pi2:session","ts":3000,"session":{"status":"idle","cwd":"/repo","model":{"provider":"anthropic","id":"claude-sonnet-4-5"},"thinking":"off"}}
{"type":"agent_start","ts":3001}
{"type":"message_start","ts":3002,"message":{"role":"assistant","content":[],"timestamp":3002}}
{"type":"message_update","ts":3003,"assistantMessageEvent":{"type":"text_start","contentIndex":0}}
{"type":"message_update","ts":3004,"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":"partial answer"}}
{"type":"message_update","ts":3005,"assistantMessageEvent":{"type":"error","reason":"aborted","error":"Aborted by user"}}
{"type":"pi2:error","ts":3006,"message":"Aborted by user"}
{"type":"agent_settled","ts":3007,"aborted":true}
{"type":"compaction_start","ts":3010,"reason":"manual"}
{"type":"compaction_end","ts":3020,"reason":"manual","success":true}
{"type":"pi2:process_exit","ts":3030,"code":0,"signal":null}