@particle-academy/fancy-chat-js 0.0.0-stage → 0.2.0

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.
@@ -0,0 +1,619 @@
1
+ {
2
+ "v": 1,
3
+ "about": "Shared conformance cases for the agent chat contract v1. Byte-identical in fancy-chat-js and fancy-chat-php; each leg pins its sha256. A section lists the legs that must pass it.",
4
+ "envelope": {
5
+ "legs": ["js", "php"],
6
+ "cases": [
7
+ { "name": "minimal core event", "event": { "v": 1, "seq": 1, "threadId": "t_1", "at": "2026-11-15T10:00:00.000Z", "type": "turn.started", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_1" } }, "ok": true, "error": null },
8
+ { "name": "unknown fields are ignored", "event": { "v": 1, "seq": 2, "threadId": "t_1", "at": "2026-11-15T10:00:00.000Z", "type": "usage", "actor": { "kind": "agent", "id": "a" }, "data": {}, "futureField": { "x": 1 } }, "ok": true, "error": null },
9
+ { "name": "app extension type", "event": { "v": 1, "seq": 3, "threadId": "t_1", "at": "2026-11-15T10:00:00.000Z", "type": "x-moic.deal-updated", "actor": { "kind": "agent", "id": "a" }, "data": {} }, "ok": true, "error": null },
10
+ { "name": "unknown major is refused", "event": { "v": 2, "seq": 1, "threadId": "t_1", "at": "2026-11-15T10:00:00.000Z", "type": "usage", "actor": { "kind": "agent", "id": "a" }, "data": {} }, "ok": false, "error": "contract.version" },
11
+ { "name": "missing version is refused", "event": { "seq": 1, "threadId": "t_1", "at": "2026-11-15T10:00:00.000Z", "type": "usage", "actor": { "kind": "agent", "id": "a" }, "data": {} }, "ok": false, "error": "contract.version" },
12
+ { "name": "seq must be a positive integer", "event": { "v": 1, "seq": 0, "threadId": "t_1", "at": "2026-11-15T10:00:00.000Z", "type": "usage", "actor": { "kind": "agent", "id": "a" }, "data": {} }, "ok": false, "error": "event.seq" },
13
+ { "name": "fractional seq", "event": { "v": 1, "seq": 1.5, "threadId": "t_1", "at": "2026-11-15T10:00:00.000Z", "type": "usage", "actor": { "kind": "agent", "id": "a" }, "data": {} }, "ok": false, "error": "event.seq" },
14
+ { "name": "empty thread id", "event": { "v": 1, "seq": 1, "threadId": "", "at": "2026-11-15T10:00:00.000Z", "type": "usage", "actor": { "kind": "agent", "id": "a" }, "data": {} }, "ok": false, "error": "event.threadId" },
15
+ { "name": "type outside the closed set", "event": { "v": 1, "seq": 1, "threadId": "t_1", "at": "2026-11-15T10:00:00.000Z", "type": "message.exploded", "actor": { "kind": "agent", "id": "a" }, "data": {} }, "ok": false, "error": "event.type" },
16
+ { "name": "extension without a namespace", "event": { "v": 1, "seq": 1, "threadId": "t_1", "at": "2026-11-15T10:00:00.000Z", "type": "x-deal", "actor": { "kind": "agent", "id": "a" }, "data": {} }, "ok": false, "error": "event.type" },
17
+ { "name": "bad timestamp", "event": { "v": 1, "seq": 1, "threadId": "t_1", "at": "yesterday", "type": "usage", "actor": { "kind": "agent", "id": "a" }, "data": {} }, "ok": false, "error": "event.at" },
18
+ { "name": "unknown actor kind", "event": { "v": 1, "seq": 1, "threadId": "t_1", "at": "2026-11-15T10:00:00.000Z", "type": "usage", "actor": { "kind": "robot", "id": "a" }, "data": {} }, "ok": false, "error": "event.actor" },
19
+ { "name": "data must be an object", "event": { "v": 1, "seq": 1, "threadId": "t_1", "at": "2026-11-15T10:00:00.000Z", "type": "usage", "actor": { "kind": "agent", "id": "a" }, "data": [1, 2] }, "ok": false, "error": "event.data" },
20
+ { "name": "run ids may be null", "event": { "v": 1, "seq": 1, "threadId": "t_1", "runId": null, "parentRunId": null, "rootRunId": null, "turnId": null, "at": "2026-11-15T10:00:00.000Z", "type": "run.started", "actor": { "kind": "agent", "id": "a" }, "data": {} }, "ok": true, "error": null },
21
+ { "name": "run id must be a string", "event": { "v": 1, "seq": 1, "threadId": "t_1", "runId": 9, "at": "2026-11-15T10:00:00.000Z", "type": "run.started", "actor": { "kind": "agent", "id": "a" }, "data": {} }, "ok": false, "error": "event.runId" }
22
+ ]
23
+ },
24
+ "turn": {
25
+ "legs": ["js", "php"],
26
+ "cases": [
27
+ { "from": "pending", "action": "start", "ok": true, "to": "running", "outcome": null, "reason": null },
28
+ { "from": "running", "action": "park", "ok": true, "to": "awaiting-human", "outcome": null, "reason": null },
29
+ { "from": "awaiting-human", "action": "resume", "ok": true, "to": "running", "outcome": null, "reason": null },
30
+ { "from": "running", "action": "cancel", "ok": true, "to": "cancelling", "outcome": null, "reason": null },
31
+ { "from": "awaiting-human", "action": "cancel", "ok": true, "to": "cancelling", "outcome": null, "reason": null },
32
+ { "from": "cancelling", "action": "cancelled", "ok": true, "to": "settled", "outcome": "cancelled", "reason": null },
33
+ { "from": "cancelling", "action": "interrupted", "ok": true, "to": "settled", "outcome": "interrupted", "reason": null },
34
+ { "from": "running", "action": "finish", "ok": true, "to": "settled", "outcome": "completed", "reason": null },
35
+ { "from": "running", "action": "fail", "ok": true, "to": "settled", "outcome": "failed", "reason": null },
36
+ { "from": "running", "action": "refuse", "ok": true, "to": "settled", "outcome": "refused", "reason": null },
37
+ { "from": "running", "action": "reap", "ok": true, "to": "settled", "outcome": "failed", "reason": "stalled" },
38
+ { "from": "awaiting-human", "action": "reap", "ok": true, "to": "settled", "outcome": "failed", "reason": "stalled" },
39
+ { "from": "pending", "action": "finish", "ok": false, "to": null, "outcome": null, "reason": null },
40
+ { "from": "awaiting-human", "action": "finish", "ok": false, "to": null, "outcome": null, "reason": null },
41
+ { "from": "settled", "action": "start", "ok": false, "to": null, "outcome": null, "reason": null },
42
+ { "from": "settled", "action": "reap", "ok": false, "to": null, "outcome": null, "reason": null },
43
+ { "from": "cancelling", "action": "resume", "ok": false, "to": null, "outcome": null, "reason": null },
44
+ { "from": "running", "action": "explode", "ok": false, "to": null, "outcome": null, "reason": null },
45
+ { "from": "nowhere", "action": "start", "ok": false, "to": null, "outcome": null, "reason": null }
46
+ ]
47
+ },
48
+ "delivery": {
49
+ "legs": ["js", "php"],
50
+ "cases": [
51
+ { "from": "sending", "action": "ack", "ok": true, "to": "sent" },
52
+ { "from": "sending", "action": "fail", "ok": true, "to": "failed" },
53
+ { "from": "sent", "action": "queue", "ok": true, "to": "queued" },
54
+ { "from": "sent", "action": "deliver", "ok": true, "to": "delivered" },
55
+ { "from": "sent", "action": "steer", "ok": true, "to": "steered" },
56
+ { "from": "queued", "action": "steer", "ok": true, "to": "steered" },
57
+ { "from": "queued", "action": "unsend", "ok": true, "to": "unsent" },
58
+ { "from": "queued", "action": "drop", "ok": true, "to": "dropped" },
59
+ { "from": "sent", "action": "unsend", "ok": false, "to": null },
60
+ { "from": "delivered", "action": "unsend", "ok": false, "to": null },
61
+ { "from": "unsent", "action": "deliver", "ok": false, "to": null },
62
+ { "from": "failed", "action": "ack", "ok": false, "to": null },
63
+ { "from": "sent", "action": "decide", "ok": true, "to": "decided" },
64
+ { "from": "queued", "action": "decide", "ok": true, "to": "decided" },
65
+ { "from": "decided", "action": "deliver", "ok": false, "to": null },
66
+ { "from": "decided", "action": "unsend", "ok": false, "to": null },
67
+ { "from": "delivered", "action": "decide", "ok": false, "to": null },
68
+ { "from": "sending", "action": "decide", "ok": false, "to": null }
69
+ ]
70
+ },
71
+ "approval": {
72
+ "legs": ["js", "php"],
73
+ "cases": [
74
+ { "from": "pending", "action": "begin-decision", "ok": true, "to": "deciding" },
75
+ { "from": "deciding", "action": "decision-failed", "ok": true, "to": "pending" },
76
+ { "from": "deciding", "action": "approve", "ok": true, "to": "approved" },
77
+ { "from": "deciding", "action": "reject", "ok": true, "to": "rejected" },
78
+ { "from": "deciding", "action": "edit", "ok": true, "to": "edited" },
79
+ { "from": "approved", "action": "apply", "ok": true, "to": "applied" },
80
+ { "from": "edited", "action": "apply-fail", "ok": true, "to": "apply-failed" },
81
+ { "from": "pending", "action": "withdraw", "ok": true, "to": "withdrawn" },
82
+ { "from": "pending", "action": "expire", "ok": true, "to": "expired" },
83
+ { "from": "pending", "action": "approve", "ok": false, "to": null },
84
+ { "from": "pending", "action": "apply", "ok": false, "to": null },
85
+ { "from": "rejected", "action": "apply", "ok": false, "to": null },
86
+ { "from": "deciding", "action": "withdraw", "ok": false, "to": null },
87
+ { "from": "applied", "action": "approve", "ok": false, "to": null }
88
+ ]
89
+ },
90
+ "optionTone": {
91
+ "legs": ["js", "php"],
92
+ "cases": [
93
+ { "kind": "allow-once", "label": "Reject", "tone": "positive", "decision": "approve" },
94
+ { "kind": "allow-always", "label": "Always", "tone": "positive", "decision": "approve" },
95
+ { "kind": "reject-once", "label": "Allow", "tone": "negative", "decision": "reject" },
96
+ { "kind": "reject-always", "label": "Never", "tone": "negative", "decision": "reject" },
97
+ { "kind": "edit", "label": "Approve with changes", "tone": "neutral", "decision": "edit" },
98
+ { "kind": "approve-everything", "label": "Approve", "tone": null, "decision": null }
99
+ ]
100
+ },
101
+ "decide": {
102
+ "legs": ["js", "php"],
103
+ "cases": [
104
+ { "actor": { "kind": "human", "id": "u_1" }, "allowed": true },
105
+ { "actor": { "kind": "agent", "id": "compass" }, "allowed": false },
106
+ { "actor": { "kind": "system", "id": "server" }, "allowed": false },
107
+ { "actor": { "kind": "human", "id": "" }, "allowed": false },
108
+ { "actor": { "kind": "Human", "id": "u_1" }, "allowed": false },
109
+ { "actor": null, "allowed": false }
110
+ ]
111
+ },
112
+ "reservedTools": {
113
+ "legs": ["js", "php"],
114
+ "cases": [
115
+ { "name": "hitl_decide", "reserved": true },
116
+ { "name": "question_answer", "reserved": true },
117
+ { "name": "send_as_human", "reserved": true },
118
+ { "name": "approve_tool_call", "reserved": true },
119
+ { "name": "Request_Approval", "reserved": true },
120
+ { "name": "confirm_action", "reserved": true },
121
+ { "name": "grant_permission", "reserved": true },
122
+ { "name": "chat_read", "reserved": false },
123
+ { "name": "hitl_list", "reserved": false },
124
+ { "name": "chat_draft_set", "reserved": false }
125
+ ]
126
+ },
127
+ "question": {
128
+ "legs": ["js", "php"],
129
+ "question": {
130
+ "questionId": "q_1",
131
+ "prompt": "How should we ship?",
132
+ "fields": [
133
+ { "id": "when", "type": "single", "options": [{ "id": "now", "label": "Now" }, { "id": "later", "label": "Later" }], "required": true },
134
+ { "id": "who", "type": "multi", "options": [{ "id": "a", "label": "A" }, { "id": "b", "label": "B" }], "required": true },
135
+ { "id": "why", "type": "text", "required": false }
136
+ ],
137
+ "allowNote": true
138
+ },
139
+ "cases": [
140
+ { "name": "every required field answered", "draft": { "values": { "when": "now", "who": ["a"] }, "notes": {} }, "canSubmit": true, "error": null },
141
+ { "name": "a note stands in for an option", "draft": { "values": { "when": "now" }, "notes": { "who": "neither, ask me" } }, "canSubmit": true, "error": null },
142
+ { "name": "blank note does not count", "draft": { "values": { "when": "now" }, "notes": { "who": " " } }, "canSubmit": false, "error": "question.required" },
143
+ { "name": "required single missing", "draft": { "values": { "who": ["b"] }, "notes": {} }, "canSubmit": false, "error": "question.required" },
144
+ { "name": "option not offered", "draft": { "values": { "when": "tomorrow", "who": ["a"] }, "notes": {} }, "canSubmit": false, "error": "question.option" },
145
+ { "name": "multi with an unknown option", "draft": { "values": { "when": "now", "who": ["a", "z"] }, "notes": {} }, "canSubmit": false, "error": "question.option" },
146
+ { "name": "empty multi is not an answer", "draft": { "values": { "when": "now", "who": [] }, "notes": {} }, "canSubmit": false, "error": "question.required" },
147
+ { "name": "unknown field", "draft": { "values": { "when": "now", "who": ["a"], "extra": "x" }, "notes": {} }, "canSubmit": false, "error": "question.field" },
148
+ { "name": "text field must be a string", "draft": { "values": { "when": "now", "who": ["a"], "why": 5 }, "notes": {} }, "canSubmit": false, "error": "question.value" },
149
+ { "name": "a note does not count when the question allows none", "allowNote": false, "draft": { "values": { "when": "now" }, "notes": { "who": "neither" } }, "canSubmit": false, "error": "question.required" }
150
+ ]
151
+ },
152
+ "actionable": {
153
+ "legs": ["js", "php"],
154
+ "cases": [
155
+ { "name": "oldest pending wins", "items": [{ "id": "ap_2", "kind": "approval", "state": "pending", "seq": 9 }, { "id": "q_1", "kind": "question", "state": "open", "seq": 4 }], "actionable": "q_1" },
156
+ { "name": "settled items never act", "items": [{ "id": "ap_1", "kind": "approval", "state": "applied", "seq": 1 }, { "id": "ap_2", "kind": "approval", "state": "pending", "seq": 5 }], "actionable": "ap_2" },
157
+ { "name": "an in-flight decision locks every other item", "items": [{ "id": "ap_1", "kind": "approval", "state": "deciding", "seq": 1 }, { "id": "ap_2", "kind": "approval", "state": "pending", "seq": 5 }], "actionable": null },
158
+ { "name": "nothing pending", "items": [{ "id": "q_1", "kind": "question", "state": "answered", "seq": 1 }], "actionable": null },
159
+ { "name": "kinds outside the profile are ignored", "items": [{ "id": "q_1", "kind": "question", "state": "open", "seq": 1 }, { "id": "ap_1", "kind": "approval", "state": "pending", "seq": 2 }], "kinds": ["approval"], "actionable": "ap_1" }
160
+ ]
161
+ },
162
+ "parts": {
163
+ "legs": ["js", "php"],
164
+ "cases": [
165
+ { "name": "markdown text", "part": { "id": "p1", "kind": "text", "format": "markdown", "text": "Hello **there**" }, "context": { "origin": "agent" }, "ok": true, "error": null, "text": "Hello **there**" },
166
+ { "name": "text format outside the set", "part": { "id": "p1", "kind": "text", "format": "html", "text": "<b>x</b>" }, "context": { "origin": "agent" }, "ok": false, "error": "part.text", "text": null },
167
+ { "name": "code", "part": { "id": "p2", "kind": "code", "language": "php", "code": "echo 1;" }, "context": { "origin": "agent" }, "ok": true, "error": null, "text": "```php\necho 1;\n```" },
168
+ { "name": "table copies as TSV", "part": { "id": "p3", "kind": "table", "columns": [{ "key": "name", "label": "Name" }, { "key": "n", "label": "Count", "type": "number" }], "rows": [{ "name": "a", "n": 1 }, { "name": "b", "n": 2 }] }, "context": { "origin": "agent" }, "ok": true, "error": null, "text": "Name\tCount\na\t1\nb\t2" },
169
+ { "name": "table column needs a key", "part": { "id": "p3", "kind": "table", "columns": [{ "label": "Name" }], "rows": [] }, "context": { "origin": "agent" }, "ok": false, "error": "part.table", "text": null },
170
+ { "name": "neutral chart spec", "part": { "id": "p4", "kind": "chart", "title": "Revenue", "spec": { "type": "bar", "series": [{ "name": "2026", "data": [1, 2, 3] }], "x": { "categories": ["Jan", "Feb", "Mar"] } } }, "context": { "origin": "agent" }, "ok": true, "error": null, "text": "[chart: Revenue]" },
171
+ { "name": "chart type outside the set", "part": { "id": "p4", "kind": "chart", "spec": { "type": "sankey3d", "series": [] } }, "context": { "origin": "agent" }, "ok": false, "error": "part.chart", "text": null },
172
+ { "name": "raw echarts from an agent is refused", "part": { "id": "p4", "kind": "chart", "echarts": { "series": [] } }, "context": { "origin": "agent" }, "ok": false, "error": "part.chart.raw", "text": null },
173
+ { "name": "raw echarts from trusted server code", "part": { "id": "p4", "kind": "chart", "echarts": { "series": [] } }, "context": { "origin": "server" }, "ok": true, "error": null, "text": "[chart]" },
174
+ { "name": "file", "part": { "id": "p5", "kind": "file", "name": "report.pdf", "mimeType": "application/pdf", "size": 1024, "ref": "f_1" }, "context": { "origin": "agent" }, "ok": true, "error": null, "text": "[file: report.pdf]" },
175
+ { "name": "negative file size", "part": { "id": "p5", "kind": "file", "name": "report.pdf", "mimeType": "application/pdf", "size": -1, "ref": "f_1" }, "context": { "origin": "agent" }, "ok": false, "error": "part.file", "text": null },
176
+ { "name": "image", "part": { "id": "p6", "kind": "image", "ref": "img_1", "alt": "A cat" }, "context": { "origin": "agent" }, "ok": true, "error": null, "text": "[image: A cat]" },
177
+ { "name": "tool call", "part": { "id": "p7", "kind": "tool-call", "toolCallId": "tc_1", "name": "search", "args": { "q": "x" } }, "context": { "origin": "agent" }, "ok": true, "error": null, "text": "[tool: search]" },
178
+ { "name": "tool result refusal is not an error", "part": { "id": "p8", "kind": "tool-result", "toolCallId": "tc_1", "outcome": "refusal", "content": "Not allowed here." }, "context": { "origin": "agent" }, "ok": true, "error": null, "text": "Not allowed here." },
179
+ { "name": "tool result outcome outside the set", "part": { "id": "p8", "kind": "tool-result", "toolCallId": "tc_1", "outcome": "meh", "content": "" }, "context": { "origin": "agent" }, "ok": false, "error": "part.tool-result", "text": null },
180
+ { "name": "card with nested parts", "part": { "id": "p9", "kind": "card", "cardType": "deal", "title": "Acme", "body": [{ "id": "p9a", "kind": "text", "format": "plain", "text": "Stage: won" }], "actions": [{ "id": "open", "label": "Open", "kind": "link", "href": "https://example.com/deal/1" }, { "id": "nudge", "label": "Nudge", "kind": "post-back" }] }, "context": { "origin": "agent" }, "ok": true, "error": null, "text": "Acme\nStage: won" },
181
+ { "name": "card link must be http(s)", "part": { "id": "p9", "kind": "card", "cardType": "deal", "body": [], "actions": [{ "id": "open", "label": "Open", "kind": "link", "href": "javascript:alert(1)" }] }, "context": { "origin": "agent" }, "ok": false, "error": "part.card.action", "text": null },
182
+ { "name": "card nesting is capped", "part": { "id": "c1", "kind": "card", "cardType": "x", "body": [{ "id": "c2", "kind": "card", "cardType": "x", "body": [{ "id": "c3", "kind": "card", "cardType": "x", "body": [{ "id": "c4", "kind": "card", "cardType": "x", "body": [] }] }] }] }, "context": { "origin": "agent" }, "ok": false, "error": "part.depth", "text": null },
183
+ { "name": "approval parts come only from server records", "part": { "id": "p10", "kind": "approval", "approvalId": "ap_1" }, "context": { "origin": "agent" }, "ok": false, "error": "part.hitl.origin", "text": null },
184
+ { "name": "approval part placed by the server", "part": { "id": "p10", "kind": "approval", "approvalId": "ap_1" }, "context": { "origin": "server" }, "ok": true, "error": null, "text": "[approval]" },
185
+ { "name": "question part from an agent", "part": { "id": "p11", "kind": "question", "questionId": "q_1" }, "context": { "origin": "agent" }, "ok": false, "error": "part.hitl.origin", "text": null },
186
+ { "name": "app extension kind", "part": { "id": "p12", "kind": "x-moic.deal", "dealId": 7 }, "context": { "origin": "agent" }, "ok": true, "error": null, "text": "[x-moic.deal]" },
187
+ { "name": "unknown core kind", "part": { "id": "p13", "kind": "video" }, "context": { "origin": "agent" }, "ok": false, "error": "part.kind", "text": null },
188
+ { "name": "part needs an id", "part": { "kind": "text", "format": "plain", "text": "x" }, "context": { "origin": "agent" }, "ok": false, "error": "part.id", "text": null },
189
+ { "name": "size cap", "part": { "id": "p14", "kind": "text", "format": "plain", "text": "0123456789012345678901234567890123456789" }, "context": { "origin": "agent", "limits": { "maxPartBytes": 32 } }, "ok": false, "error": "part.size", "text": null }
190
+ ]
191
+ },
192
+ "status": {
193
+ "legs": ["js", "php"],
194
+ "config": { "coolingMs": 15000, "sleepAfterMs": 600000 },
195
+ "cases": [
196
+ { "name": "never started", "snapshot": { "now": 1000000 }, "expect": { "status": "not-started", "detail": null, "since": null, "recovery": [] } },
197
+ { "name": "broken wins over everything", "snapshot": { "now": 1000000, "broken": "provider unreachable", "turn": { "state": "running", "since": 999000 }, "everStarted": true }, "expect": { "status": "broken", "detail": { "reason": "provider unreachable" }, "since": null, "recovery": ["restart"] } },
198
+ { "name": "signed out", "snapshot": { "now": 1000000, "signedIn": false, "everStarted": true }, "expect": { "status": "signed-out", "detail": null, "since": null, "recovery": ["sign-in"] } },
199
+ { "name": "paused on a limit", "snapshot": { "now": 1000000, "limit": { "until": 1060000 }, "everStarted": true }, "expect": { "status": "paused-limit", "detail": { "until": 1060000 }, "since": null, "recovery": ["wait"] } },
200
+ { "name": "an expired limit no longer pauses", "snapshot": { "now": 1000000, "limit": { "until": 999999 }, "everStarted": true, "lastSettledAt": 900000 }, "expect": { "status": "idle", "detail": null, "since": 915000, "recovery": [] } },
201
+ { "name": "parked on a human", "snapshot": { "now": 1000000, "turn": { "state": "awaiting-human", "since": 990000 }, "pendingHitl": 1, "everStarted": true }, "expect": { "status": "parked", "detail": { "pending": 1 }, "since": 990000, "recovery": ["open-hitl"] } },
202
+ { "name": "pending hitl parks even between turns", "snapshot": { "now": 1000000, "pendingHitl": 2, "everStarted": true, "lastSettledAt": 990000 }, "expect": { "status": "parked", "detail": { "pending": 2 }, "since": null, "recovery": ["open-hitl"] } },
203
+ { "name": "starting", "snapshot": { "now": 1000000, "turn": { "state": "pending", "since": 999500 }, "everStarted": true }, "expect": { "status": "starting", "detail": null, "since": 999500, "recovery": ["stop"] } },
204
+ { "name": "working with a plan and background work", "snapshot": { "now": 1000000, "turn": { "state": "running", "since": 995000 }, "background": 2, "plan": { "n": 2, "m": 5, "doing": "Drafting" }, "everStarted": true }, "expect": { "status": "working", "detail": { "background": 2, "plan": { "n": 2, "m": 5, "doing": "Drafting" }, "cancelling": false }, "since": 995000, "recovery": ["stop"] } },
205
+ { "name": "cancelling is still working", "snapshot": { "now": 1000000, "turn": { "state": "cancelling", "since": 999000 }, "everStarted": true }, "expect": { "status": "working", "detail": { "background": 0, "plan": null, "cancelling": true }, "since": 999000, "recovery": [] } },
206
+ { "name": "background work with no turn", "snapshot": { "now": 1000000, "background": 1, "everStarted": true, "lastSettledAt": 100 }, "expect": { "status": "working", "detail": { "background": 1, "plan": null, "cancelling": false }, "since": null, "recovery": [] } },
207
+ { "name": "cooling just after a turn", "snapshot": { "now": 1000000, "everStarted": true, "lastSettledAt": 990000 }, "expect": { "status": "cooling", "detail": null, "since": 990000, "recovery": [] } },
208
+ { "name": "cooling ends exactly at the window", "snapshot": { "now": 1005000, "everStarted": true, "lastSettledAt": 990000 }, "expect": { "status": "idle", "detail": null, "since": 1005000, "recovery": [] } },
209
+ { "name": "sleeping after a long idle", "snapshot": { "now": 2000000, "everStarted": true, "lastSettledAt": 1000000 }, "expect": { "status": "sleeping", "detail": null, "since": 1600000, "recovery": [] } },
210
+ { "name": "host recovery overrides", "snapshot": { "now": 1000000, "broken": "x", "everStarted": true }, "config": { "recovery": { "broken": ["restart", "report"] } }, "expect": { "status": "broken", "detail": { "reason": "x" }, "since": null, "recovery": ["restart", "report"] } }
211
+ ]
212
+ },
213
+ "projection": {
214
+ "legs": ["js", "php"],
215
+ "defaults": { "v": 1, "threadId": "t_1", "at": "2026-11-15T10:00:00.000Z", "actor": { "kind": "agent", "id": "compass" }, "data": {} },
216
+ "cases": [
217
+ {
218
+ "name": "a streamed answer with thinking and a tool",
219
+ "events": [
220
+ { "seq": 1, "type": "message.created", "actor": { "kind": "human", "id": "u_1" }, "data": { "turnId": "u_4", "message": { "id": "m_1", "role": "user", "parts": [{ "id": "p1", "kind": "text", "format": "plain", "text": "Find Acme" }], "delivery": "sent" } } },
221
+ { "seq": 2, "type": "turn.started", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_4", "messageId": "m_1" } },
222
+ { "seq": 3, "type": "turn.transition", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_4", "action": "start" } },
223
+ { "seq": 4, "type": "delivery.changed", "actor": { "kind": "system", "id": "server" }, "data": { "messageId": "m_1", "action": "deliver" } },
224
+ { "seq": 5, "type": "thinking.started", "runId": "r_9" },
225
+ { "seq": 6, "type": "thinking.delta", "runId": "r_9", "data": { "text": "Look up " } },
226
+ { "seq": 7, "type": "thinking.delta", "runId": "r_9", "data": { "text": "the deal." } },
227
+ { "seq": 8, "type": "thinking.completed", "runId": "r_9" },
228
+ { "seq": 9, "type": "tool.called", "runId": "r_9", "data": { "toolCallId": "tc_1", "name": "search_deals", "args": { "q": "Acme" }, "startedAt": "2026-11-15T10:00:01.000Z" } },
229
+ { "seq": 10, "type": "tool.progress", "runId": "r_9", "data": { "toolCallId": "tc_1", "fraction": 0.5 } },
230
+ { "seq": 11, "type": "tool.result", "runId": "r_9", "data": { "toolCallId": "tc_1", "outcome": "ok", "durationMs": 420, "outputRef": "o_1", "truncated": false, "output": null, "outputLanguage": null } },
231
+ { "seq": 12, "type": "thinking.started", "runId": "r_9" },
232
+ { "seq": 13, "type": "thinking.delta", "runId": "r_9", "data": { "text": " Found it." } },
233
+ { "seq": 14, "type": "message.created", "runId": "r_9", "data": { "turnId": "u_4", "message": { "id": "m_2", "role": "assistant", "parts": [] } } },
234
+ { "seq": 15, "type": "part.started", "runId": "r_9", "data": { "messageId": "m_2", "part": { "id": "p2", "kind": "text", "format": "markdown", "text": "Acme is " } } },
235
+ { "seq": 16, "type": "part.delta", "runId": "r_9", "data": { "messageId": "m_2", "partId": "p2", "text": "**won**." } },
236
+ { "seq": 17, "type": "part.completed", "runId": "r_9", "data": { "messageId": "m_2", "partId": "p2" } },
237
+ { "seq": 18, "type": "turn.settled", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_4", "action": "finish" } }
238
+ ],
239
+ "expect": {
240
+ "lastSeq": 18,
241
+ "illegal": 0,
242
+ "turns": [{ "turnId": "u_4", "state": "settled", "outcome": "completed", "reason": null, "messageId": "m_1" }],
243
+ "approvals": [],
244
+ "questions": [],
245
+ "rows": [
246
+ { "kind": "message", "id": "m_1", "role": "user", "author": { "kind": "human", "id": "u_1" }, "turnId": "u_4", "parts": [{ "id": "p1", "kind": "text", "format": "plain", "text": "Find Acme" }], "open": [], "delivery": "delivered", "supersedes": null, "retracted": false, "superseded": false },
247
+ { "kind": "thinking", "id": "r_9", "thinkingId": "r_9", "runId": "r_9", "text": "Look up the deal.", "live": false },
248
+ { "kind": "tool", "id": "tc_1", "runId": "r_9", "toolCallId": "tc_1", "name": "search_deals", "args": { "q": "Acme" }, "startedAt": "2026-11-15T10:00:01.000Z", "progress": { "fraction": 0.5, "text": null }, "outcome": "ok", "durationMs": 420, "durationExact": true, "outputRef": "o_1", "truncated": false, "output": null, "outputLanguage": null },
249
+ { "kind": "thinking", "id": "r_9#2", "thinkingId": "r_9#2", "runId": "r_9", "text": " Found it.", "live": true },
250
+ { "kind": "message", "id": "m_2", "role": "assistant", "author": { "kind": "agent", "id": "compass" }, "turnId": "u_4", "parts": [{ "id": "p2", "kind": "text", "format": "markdown", "text": "Acme is **won**." }], "open": [], "delivery": null, "supersedes": null, "retracted": false, "superseded": false }
251
+ ]
252
+ }
253
+ },
254
+ {
255
+ "name": "thinking interleaves within one run: several blocks, in order; an inexact tool duration",
256
+ "events": [
257
+ { "seq": 1, "type": "thinking.started", "runId": "r_1" },
258
+ { "seq": 2, "type": "thinking.delta", "runId": "r_1", "data": { "text": "A" } },
259
+ { "seq": 3, "type": "thinking.completed", "runId": "r_1" },
260
+ { "seq": 4, "type": "tool.called", "runId": "r_1", "data": { "toolCallId": "tc_1", "name": "search", "args": {} } },
261
+ { "seq": 5, "type": "tool.result", "runId": "r_1", "data": { "toolCallId": "tc_1", "outcome": "ok", "durationMs": 1200, "durationExact": false } },
262
+ { "seq": 6, "type": "thinking.delta", "runId": "r_1", "data": { "text": "B" } },
263
+ { "seq": 7, "type": "thinking.completed", "runId": "r_1" },
264
+ { "seq": 8, "type": "thinking.started", "runId": "r_1", "data": { "thinkingId": "th_x" } },
265
+ { "seq": 9, "type": "thinking.delta", "runId": "r_1", "data": { "thinkingId": "th_x", "text": "C" } },
266
+ { "seq": 10, "type": "thinking.delta", "runId": "r_1", "data": { "text": "D" } },
267
+ { "seq": 11, "type": "thinking.completed", "runId": "r_2" },
268
+ { "seq": 12, "type": "thinking.delta", "runId": "r_1", "data": { "thinkingId": 7, "text": "E" } },
269
+ { "seq": 13, "type": "tool.called", "runId": "r_1", "data": { "toolCallId": "tc_2", "name": "x", "args": {} } },
270
+ { "seq": 14, "type": "tool.result", "runId": "r_1", "data": { "toolCallId": "tc_2", "outcome": "ok", "durationMs": 5, "durationExact": "no" } }
271
+ ],
272
+ "expect": {
273
+ "lastSeq": 14,
274
+ "illegal": 2,
275
+ "turns": [],
276
+ "approvals": [],
277
+ "questions": [],
278
+ "rows": [
279
+ { "kind": "thinking", "id": "r_1", "thinkingId": "r_1", "runId": "r_1", "text": "A", "live": false },
280
+ { "kind": "tool", "id": "tc_1", "runId": "r_1", "toolCallId": "tc_1", "name": "search", "args": {}, "startedAt": null, "progress": null, "outcome": "ok", "durationMs": 1200, "durationExact": false, "outputRef": null, "truncated": false, "output": null, "outputLanguage": null },
281
+ { "kind": "thinking", "id": "r_1#2", "thinkingId": "r_1#2", "runId": "r_1", "text": "B", "live": false },
282
+ { "kind": "thinking", "id": "th_x", "thinkingId": "th_x", "runId": "r_1", "text": "CD", "live": true },
283
+ { "kind": "tool", "id": "tc_2", "runId": "r_1", "toolCallId": "tc_2", "name": "x", "args": {}, "startedAt": null, "progress": null, "outcome": "ok", "durationMs": 5, "durationExact": true, "outputRef": null, "truncated": false, "output": null, "outputLanguage": null }
284
+ ]
285
+ }
286
+ },
287
+ {
288
+ "name": "a turn links to the message that started it, both ways",
289
+ "events": [
290
+ { "seq": 1, "type": "message.created", "actor": { "kind": "human", "id": "u_1" }, "data": { "message": { "id": "m_1", "role": "user", "parts": [{ "id": "p1", "kind": "text", "format": "plain", "text": "Draft it" }], "delivery": "sent" } } },
291
+ { "seq": 2, "type": "turn.started", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_1", "messageId": "m_1" } },
292
+ { "seq": 3, "type": "turn.started", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_2", "messageId": "m_missing" } },
293
+ { "seq": 4, "type": "turn.started", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_3", "messageId": 7 } },
294
+ { "seq": 5, "type": "turn.started", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_4", "messageId": "m_1" } }
295
+ ],
296
+ "expect": {
297
+ "lastSeq": 5,
298
+ "illegal": 0,
299
+ "turns": [
300
+ { "turnId": "u_1", "state": "pending", "outcome": null, "reason": null, "messageId": "m_1" },
301
+ { "turnId": "u_2", "state": "pending", "outcome": null, "reason": null, "messageId": null },
302
+ { "turnId": "u_3", "state": "pending", "outcome": null, "reason": null, "messageId": null },
303
+ { "turnId": "u_4", "state": "pending", "outcome": null, "reason": null, "messageId": "m_1" }
304
+ ],
305
+ "approvals": [],
306
+ "questions": [],
307
+ "rows": [
308
+ { "kind": "message", "id": "m_1", "role": "user", "author": { "kind": "human", "id": "u_1" }, "turnId": "u_1", "parts": [{ "id": "p1", "kind": "text", "format": "plain", "text": "Draft it" }], "open": [], "delivery": "sent", "supersedes": null, "retracted": false, "superseded": false }
309
+ ]
310
+ }
311
+ },
312
+ {
313
+ "name": "replays and duplicates are idempotent",
314
+ "events": [
315
+ { "seq": 1, "type": "turn.started", "data": { "turnId": "u_1" } },
316
+ { "seq": 2, "type": "turn.transition", "data": { "turnId": "u_1", "action": "start" } },
317
+ { "seq": 2, "type": "turn.transition", "data": { "turnId": "u_1", "action": "start" } },
318
+ { "seq": 1, "type": "turn.started", "data": { "turnId": "u_1" } },
319
+ { "seq": 3, "type": "turn.transition", "data": { "turnId": "u_1", "action": "park" } }
320
+ ],
321
+ "expect": { "lastSeq": 3, "illegal": 0, "turns": [{ "turnId": "u_1", "state": "awaiting-human", "outcome": null, "reason": null, "messageId": null }], "approvals": [], "questions": [], "rows": [] }
322
+ },
323
+ {
324
+ "name": "illegal transitions are counted and never corrupt state",
325
+ "events": [
326
+ { "seq": 1, "type": "turn.started", "data": { "turnId": "u_1" } },
327
+ { "seq": 2, "type": "turn.transition", "data": { "turnId": "u_1", "action": "finish" } },
328
+ { "seq": 3, "type": "turn.settled", "data": { "turnId": "u_1", "action": "start" } },
329
+ { "seq": 4, "type": "turn.transition", "data": { "turnId": "u_1", "action": "start" } },
330
+ { "seq": 5, "type": "turn.transition", "data": { "turnId": "u_1", "action": "finish" } },
331
+ { "seq": 6, "type": "turn.transition", "data": { "turnId": "u_1", "action": "park" } },
332
+ { "seq": 7, "type": "turn.settled", "data": { "turnId": "u_1", "action": "reap" } },
333
+ { "seq": 8, "type": "turn.settled", "data": { "turnId": "u_1", "action": "finish" } },
334
+ { "seq": 9, "type": "turn.transition", "data": { "turnId": "u_1", "action": "start" } },
335
+ { "seq": 10, "type": "turn.transition", "data": { "turnId": "u_404", "action": "start" } },
336
+ { "seq": 11, "type": "delivery.changed", "data": { "messageId": "m_404", "action": "deliver" } }
337
+ ],
338
+ "expect": { "lastSeq": 11, "illegal": 7, "turns": [{ "turnId": "u_1", "state": "settled", "outcome": "failed", "reason": "stalled", "messageId": null }], "approvals": [], "questions": [], "rows": [] }
339
+ },
340
+ {
341
+ "name": "an approval decided by a human and applied",
342
+ "events": [
343
+ { "seq": 1, "type": "approval.requested", "actor": { "kind": "system", "id": "server" }, "data": { "approval": { "approvalId": "ap_1", "runId": "r_1", "toolCallId": "tc_1", "title": "Send the email?", "summary": "To 3 recipients", "preview": [], "options": [{ "id": "o1", "kind": "allow-once", "label": "Send" }, { "id": "o2", "kind": "reject-once", "label": "Don't send" }], "state": "pending" } } },
344
+ { "seq": 2, "type": "approval.decided", "actor": { "kind": "agent", "id": "compass" }, "data": { "approvalId": "ap_1", "decision": "approve", "decidedBy": { "kind": "agent", "id": "compass" } } },
345
+ { "seq": 3, "type": "approval.decided", "actor": { "kind": "human", "id": "u_1" }, "data": { "approvalId": "ap_1", "decision": "approve", "decidedBy": { "kind": "human", "id": "u_1" }, "optionId": "o1" } },
346
+ { "seq": 4, "type": "approval.applied", "actor": { "kind": "system", "id": "server" }, "data": { "approvalId": "ap_1", "ok": true } },
347
+ { "seq": 5, "type": "approval.requested", "actor": { "kind": "system", "id": "server" }, "data": { "approval": { "approvalId": "ap_3", "title": "Pay?", "summary": "", "preview": [], "options": [{ "id": "o1", "kind": "allow-once", "label": "Pay" }], "state": "pending" } } },
348
+ { "seq": 6, "type": "approval.decided", "actor": { "kind": "agent", "id": "compass" }, "data": { "approvalId": "ap_3", "decision": "approve", "decidedBy": { "kind": "agent", "id": "compass" } } },
349
+ { "seq": 7, "type": "approval.decided", "actor": { "kind": "agent", "id": "compass" }, "data": { "approvalId": "ap_3", "decision": "approve", "decidedBy": { "kind": "human", "id": "u_1" } } },
350
+ { "seq": 8, "type": "approval.decided", "actor": { "kind": "human", "id": "u_2" }, "data": { "approvalId": "ap_3", "decision": "approve", "decidedBy": { "kind": "human", "id": "u_1" } } }
351
+ ],
352
+ "expect": { "lastSeq": 8, "illegal": 4, "turns": [], "approvals": [{ "approvalId": "ap_1", "state": "applied" }, { "approvalId": "ap_3", "state": "pending" }], "questions": [], "rows": [{ "kind": "approval", "id": "ap_1", "approvalId": "ap_1", "state": "applied" }, { "kind": "approval", "id": "ap_3", "approvalId": "ap_3", "state": "pending" }] }
353
+ },
354
+ {
355
+ "name": "a question answered only by a human, and a withdrawn approval",
356
+ "events": [
357
+ { "seq": 1, "type": "question.asked", "actor": { "kind": "system", "id": "server" }, "data": { "question": { "questionId": "q_1", "prompt": "Which?", "fields": [{ "id": "f", "type": "text", "required": true }], "allowNote": false } } },
358
+ { "seq": 2, "type": "question.answered", "actor": { "kind": "agent", "id": "compass" }, "data": { "questionId": "q_1", "answeredBy": { "kind": "agent", "id": "compass" }, "values": { "f": "me" } } },
359
+ { "seq": 3, "type": "approval.requested", "actor": { "kind": "system", "id": "server" }, "data": { "approval": { "approvalId": "ap_2", "title": "Delete?", "summary": "", "preview": [], "options": [{ "id": "o1", "kind": "allow-once", "label": "Delete" }], "state": "pending" } } },
360
+ { "seq": 4, "type": "approval.withdrawn", "actor": { "kind": "system", "id": "server" }, "data": { "approvalId": "ap_2" } },
361
+ { "seq": 5, "type": "question.answered", "actor": { "kind": "human", "id": "u_1" }, "data": { "questionId": "q_1", "answeredBy": { "kind": "human", "id": "u_1" }, "values": { "f": "them" } } },
362
+ { "seq": 6, "type": "question.asked", "actor": { "kind": "system", "id": "server" }, "data": { "question": { "questionId": "q_2", "prompt": "Who?", "fields": [{ "id": "f", "type": "text", "required": true }], "allowNote": false } } },
363
+ { "seq": 7, "type": "question.answered", "actor": { "kind": "agent", "id": "compass" }, "data": { "questionId": "q_2", "answeredBy": { "kind": "agent", "id": "compass" }, "values": { "f": "me" } } },
364
+ { "seq": 8, "type": "question.answered", "actor": { "kind": "agent", "id": "compass" }, "data": { "questionId": "q_2", "answeredBy": { "kind": "human", "id": "u_1" }, "values": { "f": "me" } } }
365
+ ],
366
+ "expect": { "lastSeq": 8, "illegal": 3, "turns": [], "approvals": [{ "approvalId": "ap_2", "state": "withdrawn" }], "questions": [{ "questionId": "q_1", "state": "answered" }, { "questionId": "q_2", "state": "open" }], "rows": [{ "kind": "question", "id": "q_1", "questionId": "q_1", "state": "answered" }, { "kind": "approval", "id": "ap_2", "approvalId": "ap_2", "state": "withdrawn" }, { "kind": "question", "id": "q_2", "questionId": "q_2", "state": "open" }] }
367
+ },
368
+ {
369
+ "name": "edit and resend supersedes, retract hides, queue then unsend",
370
+ "events": [
371
+ { "seq": 1, "type": "message.created", "actor": { "kind": "human", "id": "u_1" }, "data": { "message": { "id": "m_1", "role": "user", "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "draft one" }], "delivery": "sent" } } },
372
+ { "seq": 2, "type": "message.created", "actor": { "kind": "human", "id": "u_1" }, "data": { "message": { "id": "m_2", "role": "user", "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "draft two" }], "delivery": "sent", "supersedes": "m_1" } } },
373
+ { "seq": 3, "type": "delivery.changed", "data": { "messageId": "m_2", "action": "queue" } },
374
+ { "seq": 4, "type": "delivery.changed", "data": { "messageId": "m_2", "action": "unsend" } },
375
+ { "seq": 5, "type": "message.created", "data": { "message": { "id": "m_3", "role": "assistant", "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "oops" }] } } },
376
+ { "seq": 6, "type": "message.retracted", "data": { "messageId": "m_3" } },
377
+ { "seq": 7, "type": "message.updated", "data": { "messageId": "m_1", "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "edited" }] } }
378
+ ],
379
+ "expect": {
380
+ "lastSeq": 7, "illegal": 0, "turns": [], "approvals": [], "questions": [],
381
+ "rows": [
382
+ { "kind": "message", "id": "m_1", "role": "user", "author": { "kind": "human", "id": "u_1" }, "turnId": null, "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "edited" }], "open": [], "delivery": "sent", "supersedes": null, "retracted": false, "superseded": true },
383
+ { "kind": "message", "id": "m_2", "role": "user", "author": { "kind": "human", "id": "u_1" }, "turnId": null, "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "draft two" }], "open": [], "delivery": "unsent", "supersedes": "m_1", "retracted": false, "superseded": false },
384
+ { "kind": "message", "id": "m_3", "role": "assistant", "author": { "kind": "agent", "id": "compass" }, "turnId": null, "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "oops" }], "open": [], "delivery": null, "supersedes": null, "retracted": true, "superseded": false }
385
+ ]
386
+ }
387
+ },
388
+ {
389
+ "name": "a reset replaces state from its snapshot",
390
+ "events": [
391
+ { "seq": 1, "type": "turn.started", "data": { "turnId": "u_1" } },
392
+ { "seq": 40, "type": "thread.reset", "actor": { "kind": "system", "id": "server" }, "data": { "snapshot": { "lastSeq": 39, "illegal": 0, "order": [{ "kind": "message", "id": "m_9" }], "messages": [{ "id": "m_9", "role": "assistant", "author": { "kind": "agent", "id": "compass" }, "turnId": null, "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "kept" }], "open": [], "delivery": null, "supersedes": null, "retracted": false, "superseded": false }], "turns": [], "thinking": [], "tools": [], "plans": [], "approvals": [], "questions": [] } } },
393
+ { "seq": 41, "type": "part.started", "data": { "messageId": "m_9", "part": { "id": "p2", "kind": "text", "format": "plain", "text": "more" } } }
394
+ ],
395
+ "expect": {
396
+ "lastSeq": 41, "illegal": 0, "turns": [], "approvals": [], "questions": [],
397
+ "rows": [
398
+ { "kind": "message", "id": "m_9", "role": "assistant", "author": { "kind": "agent", "id": "compass" }, "turnId": null, "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "kept" }, { "id": "p2", "kind": "text", "format": "plain", "text": "more" }], "open": ["p2"], "delivery": null, "supersedes": null, "retracted": false, "superseded": false }
399
+ ]
400
+ }
401
+ },
402
+ {
403
+ "name": "plan updates replace the run's plan, non-text deltas replace the part",
404
+ "events": [
405
+ { "seq": 1, "type": "plan.updated", "runId": "r_1", "data": { "steps": [{ "id": "s1", "title": "Read", "status": "running", "owner": "agent" }] } },
406
+ { "seq": 2, "type": "message.created", "runId": "r_1", "data": { "message": { "id": "m_1", "role": "assistant", "parts": [] } } },
407
+ { "seq": 3, "type": "part.started", "runId": "r_1", "data": { "messageId": "m_1", "part": { "id": "t", "kind": "table", "columns": [{ "key": "a", "label": "A" }], "rows": [] } } },
408
+ { "seq": 4, "type": "part.delta", "runId": "r_1", "data": { "messageId": "m_1", "partId": "t", "part": { "id": "t", "kind": "table", "columns": [{ "key": "a", "label": "A" }], "rows": [{ "a": 1 }] } } },
409
+ { "seq": 5, "type": "plan.updated", "runId": "r_1", "data": { "steps": [{ "id": "s1", "title": "Read", "status": "done", "owner": "agent" }, { "id": "s2", "title": "Ask", "status": "held", "owner": "human", "approvalId": "ap_1" }] } }
410
+ ],
411
+ "expect": {
412
+ "lastSeq": 5, "illegal": 0, "turns": [], "approvals": [], "questions": [],
413
+ "rows": [
414
+ { "kind": "plan", "id": "r_1", "runId": "r_1", "steps": [{ "id": "s1", "title": "Read", "status": "done", "owner": "agent" }, { "id": "s2", "title": "Ask", "status": "held", "owner": "human", "approvalId": "ap_1" }] },
415
+ { "kind": "message", "id": "m_1", "role": "assistant", "author": { "kind": "agent", "id": "compass" }, "turnId": null, "parts": [{ "id": "t", "kind": "table", "columns": [{ "key": "a", "label": "A" }], "rows": [{ "a": 1 }] }], "open": ["t"], "delivery": null, "supersedes": null, "retracted": false, "superseded": false }
416
+ ]
417
+ }
418
+ },
419
+ {
420
+ "name": "an undo window is reverted only by a human, and closes once",
421
+ "events": [
422
+ { "seq": 1, "type": "undo.opened", "actor": { "kind": "system", "id": "server" }, "data": { "actionId": "a1", "label": "Email to 3 people", "deadline": "2026-11-15T10:00:30.000Z" } },
423
+ { "seq": 2, "type": "undo.reverted", "actor": { "kind": "agent", "id": "compass" }, "data": { "actionId": "a1", "revertedBy": { "kind": "agent", "id": "compass" } } },
424
+ { "seq": 3, "type": "undo.reverted", "actor": { "kind": "human", "id": "u_1" }, "data": { "actionId": "a1", "revertedBy": { "kind": "human", "id": "u_1" } } },
425
+ { "seq": 4, "type": "undo.committed", "actor": { "kind": "system", "id": "server" }, "data": { "actionId": "a1" } },
426
+ { "seq": 5, "type": "undo.opened", "actor": { "kind": "system", "id": "server" }, "data": { "actionId": "a2", "label": "Post", "deadline": "2026-11-15T10:01:00.000Z" } },
427
+ { "seq": 6, "type": "undo.reverted", "actor": { "kind": "agent", "id": "compass" }, "data": { "actionId": "a2", "revertedBy": { "kind": "agent", "id": "compass" } } },
428
+ { "seq": 7, "type": "undo.committed", "actor": { "kind": "system", "id": "server" }, "data": { "actionId": "a2" } },
429
+ { "seq": 8, "type": "undo.opened", "actor": { "kind": "system", "id": "server" }, "data": { "actionId": "a2", "label": "Again", "deadline": "2026-11-15T10:02:00.000Z" } },
430
+ { "seq": 9, "type": "undo.opened", "actor": { "kind": "system", "id": "server" }, "data": { "actionId": "a3", "label": "No zone", "deadline": "2026-11-15 10:02:00" } }
431
+ ],
432
+ "expect": {
433
+ "lastSeq": 9, "illegal": 5, "turns": [], "approvals": [], "questions": [],
434
+ "rows": [
435
+ { "kind": "undo", "id": "a1", "actionId": "a1", "label": "Email to 3 people", "deadline": "2026-11-15T10:00:30.000Z", "state": "reverted" },
436
+ { "kind": "undo", "id": "a2", "actionId": "a2", "label": "Post", "deadline": "2026-11-15T10:01:00.000Z", "state": "committed" }
437
+ ]
438
+ }
439
+ },
440
+ {
441
+ "name": "edit and resend records the superseded branch for the host's policy",
442
+ "events": [
443
+ { "seq": 1, "type": "message.created", "actor": { "kind": "human", "id": "u_1" }, "data": { "message": { "id": "m_1", "role": "user", "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "one" }], "delivery": "sent" } } },
444
+ { "seq": 2, "type": "message.created", "data": { "message": { "id": "m_2", "role": "assistant", "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "reply" }] } } },
445
+ { "seq": 3, "type": "tool.called", "runId": "r_1", "data": { "toolCallId": "tc_1", "name": "search", "args": {} } },
446
+ { "seq": 4, "type": "message.created", "actor": { "kind": "human", "id": "u_1" }, "data": { "message": { "id": "m_3", "role": "user", "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "one, edited" }], "delivery": "sent", "supersedes": "m_1" } } },
447
+ { "seq": 5, "type": "message.created", "actor": { "kind": "human", "id": "u_1" }, "data": { "message": { "id": "m_4", "role": "user", "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "ghost" }], "delivery": "sent", "supersedes": "m_404" } } }
448
+ ],
449
+ "expect": {
450
+ "lastSeq": 5, "illegal": 0, "turns": [], "approvals": [], "questions": [],
451
+ "branches": [{ "supersededId": "m_1", "byId": "m_3", "rowIds": ["m_2", "tc_1"] }],
452
+ "rows": [
453
+ { "kind": "message", "id": "m_1", "role": "user", "author": { "kind": "human", "id": "u_1" }, "turnId": null, "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "one" }], "open": [], "delivery": "sent", "supersedes": null, "retracted": false, "superseded": true },
454
+ { "kind": "message", "id": "m_2", "role": "assistant", "author": { "kind": "agent", "id": "compass" }, "turnId": null, "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "reply" }], "open": [], "delivery": null, "supersedes": null, "retracted": false, "superseded": false },
455
+ { "kind": "tool", "id": "tc_1", "runId": "r_1", "toolCallId": "tc_1", "name": "search", "args": {}, "startedAt": null, "progress": null, "outcome": null, "durationMs": null, "durationExact": true, "outputRef": null, "truncated": false, "output": null, "outputLanguage": null },
456
+ { "kind": "message", "id": "m_3", "role": "user", "author": { "kind": "human", "id": "u_1" }, "turnId": null, "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "one, edited" }], "open": [], "delivery": "sent", "supersedes": "m_1", "retracted": false, "superseded": false },
457
+ { "kind": "message", "id": "m_4", "role": "user", "author": { "kind": "human", "id": "u_1" }, "turnId": null, "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "ghost" }], "open": [], "delivery": "sent", "supersedes": "m_404", "retracted": false, "superseded": false }
458
+ ]
459
+ }
460
+ },
461
+ {
462
+ "name": "a tool result carries its output inline: text, code, and a failure's own words",
463
+ "events": [
464
+ { "seq": 1, "type": "tool.called", "runId": "r_1", "data": { "toolCallId": "tc_1", "name": "search_deals", "args": { "q": "Acme" } } },
465
+ { "seq": 2, "type": "tool.result", "runId": "r_1", "data": { "toolCallId": "tc_1", "outcome": "ok", "durationMs": 12, "output": "{\"deals\":[7]}", "outputLanguage": "json", "truncated": true, "outputRef": "o_9" } },
466
+ { "seq": 3, "type": "tool.called", "runId": "r_1", "data": { "toolCallId": "tc_2", "name": "send_email", "args": {} } },
467
+ { "seq": 4, "type": "tool.result", "runId": "r_1", "data": { "toolCallId": "tc_2", "outcome": "failure", "output": "SMTP 550: mailbox unavailable" } },
468
+ { "seq": 5, "type": "tool.called", "runId": "r_1", "data": { "toolCallId": "tc_3", "name": "x", "args": {} } },
469
+ { "seq": 6, "type": "tool.result", "runId": "r_1", "data": { "toolCallId": "tc_3", "outcome": "ok", "output": 42, "outputLanguage": 7 } }
470
+ ],
471
+ "expect": {
472
+ "lastSeq": 6, "illegal": 0, "turns": [], "approvals": [], "questions": [],
473
+ "rows": [
474
+ { "kind": "tool", "id": "tc_1", "runId": "r_1", "toolCallId": "tc_1", "name": "search_deals", "args": { "q": "Acme" }, "startedAt": null, "progress": null, "outcome": "ok", "durationMs": 12, "durationExact": true, "outputRef": "o_9", "truncated": true, "output": "{\"deals\":[7]}", "outputLanguage": "json" },
475
+ { "kind": "tool", "id": "tc_2", "runId": "r_1", "toolCallId": "tc_2", "name": "send_email", "args": {}, "startedAt": null, "progress": null, "outcome": "failure", "durationMs": null, "durationExact": true, "outputRef": null, "truncated": false, "output": "SMTP 550: mailbox unavailable", "outputLanguage": null },
476
+ { "kind": "tool", "id": "tc_3", "runId": "r_1", "toolCallId": "tc_3", "name": "x", "args": {}, "startedAt": null, "progress": null, "outcome": "ok", "durationMs": null, "durationExact": true, "outputRef": null, "truncated": false, "output": null, "outputLanguage": null }
477
+ ]
478
+ }
479
+ },
480
+ {
481
+ "name": "a message taken as a typed decision is marked decided, never delivered",
482
+ "events": [
483
+ { "seq": 1, "type": "message.created", "actor": { "kind": "human", "id": "u_1" }, "data": { "message": { "id": "m_1", "role": "user", "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "approve" }], "delivery": "sent" } } },
484
+ { "seq": 2, "type": "delivery.changed", "actor": { "kind": "system", "id": "server" }, "data": { "messageId": "m_1", "action": "decide" } },
485
+ { "seq": 3, "type": "delivery.changed", "actor": { "kind": "system", "id": "server" }, "data": { "messageId": "m_1", "action": "deliver" } }
486
+ ],
487
+ "expect": {
488
+ "lastSeq": 3, "illegal": 1, "turns": [], "approvals": [], "questions": [],
489
+ "rows": [
490
+ { "kind": "message", "id": "m_1", "role": "user", "author": { "kind": "human", "id": "u_1" }, "turnId": null, "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "approve" }], "open": [], "delivery": "decided", "supersedes": null, "retracted": false, "superseded": false }
491
+ ]
492
+ }
493
+ },
494
+ {
495
+ "name": "a held plan step releases only through its approval",
496
+ "events": [
497
+ { "seq": 1, "type": "plan.updated", "runId": "r_1", "data": { "steps": [{ "id": "s1", "title": "Pay", "status": "held", "owner": "human", "approvalId": "ap_1" }] } },
498
+ { "seq": 2, "type": "approval.requested", "actor": { "kind": "system", "id": "server" }, "data": { "approval": { "approvalId": "ap_1", "title": "Pay?", "summary": "", "preview": [], "options": [{ "id": "o1", "kind": "allow-once", "label": "Pay" }], "state": "pending" } } },
499
+ { "seq": 3, "type": "plan.updated", "runId": "r_1", "data": { "steps": [{ "id": "s1", "title": "Pay", "status": "running", "owner": "human", "approvalId": "ap_1" }] } },
500
+ { "seq": 4, "type": "approval.decided", "actor": { "kind": "human", "id": "u_1" }, "data": { "approvalId": "ap_1", "decision": "approve", "decidedBy": { "kind": "human", "id": "u_1" }, "optionId": "o1" } },
501
+ { "seq": 5, "type": "plan.updated", "runId": "r_1", "data": { "steps": [{ "id": "s1", "title": "Pay", "status": "done", "owner": "human", "approvalId": "ap_1" }] } }
502
+ ],
503
+ "expect": {
504
+ "lastSeq": 5, "illegal": 1, "turns": [], "approvals": [{ "approvalId": "ap_1", "state": "approved" }], "questions": [],
505
+ "rows": [
506
+ { "kind": "plan", "id": "r_1", "runId": "r_1", "steps": [{ "id": "s1", "title": "Pay", "status": "done", "owner": "human", "approvalId": "ap_1" }] },
507
+ { "kind": "approval", "id": "ap_1", "approvalId": "ap_1", "state": "approved" }
508
+ ]
509
+ }
510
+ },
511
+ {
512
+ "name": "a malformed plan step is counted illegal, never thrown on, and the cursor moves past it",
513
+ "events": [
514
+ { "seq": 1, "type": "plan.updated", "runId": "r_1", "data": { "steps": [null] } },
515
+ { "seq": 2, "type": "plan.updated", "runId": "r_1", "data": { "steps": ["x", 5] } },
516
+ { "seq": 3, "type": "turn.started", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_1" } }
517
+ ],
518
+ "expect": {
519
+ "lastSeq": 3, "illegal": 2, "turns": [{ "turnId": "u_1", "state": "pending", "outcome": null, "reason": null, "messageId": null }], "approvals": [], "questions": [],
520
+ "rows": []
521
+ }
522
+ }
523
+ ]
524
+ },
525
+ "typedApproval": {
526
+ "legs": ["js", "php"],
527
+ "config": { "enabled": true, "locale": "en", "phrases": { "en": { "approve": ["approve", "Yes, approve"], "reject": ["reject", "no, reject"] }, "es": { "approve": ["aprobar"], "reject": ["rechazar"] } } },
528
+ "approval": { "approvalId": "ap_1", "title": "Send?", "summary": "", "preview": [], "state": "pending", "options": [{ "id": "o_always", "kind": "allow-always", "label": "Always" }, { "id": "o_once", "kind": "allow-once", "label": "Send" }, { "id": "o_no", "kind": "reject-once", "label": "Don't" }, { "id": "o_edit", "kind": "edit", "label": "Edit" }] },
529
+ "cases": [
530
+ { "name": "an exact phrase approves with the once option, never always", "text": "approve", "expect": { "optionId": "o_once", "decision": "approve" } },
531
+ { "name": "case, width, spacing and trailing punctuation are normalised", "text": " YES, Approve!! ", "expect": { "optionId": "o_once", "decision": "approve" } },
532
+ { "name": "fullwidth letters fold under NFKC", "text": "approve", "expect": { "optionId": "o_once", "decision": "approve" } },
533
+ { "name": "reject", "text": "No, reject.", "expect": { "optionId": "o_no", "decision": "reject" } },
534
+ { "name": "a phrase inside a sentence is not a decision", "text": "please approve it", "expect": null },
535
+ { "name": "a near miss is not a decision", "text": "approved", "expect": null },
536
+ { "name": "another locale's phrase does not match", "text": "aprobar", "expect": null },
537
+ { "name": "the host's locale is used", "text": "aprobar", "config": { "locale": "es" }, "expect": { "optionId": "o_once", "decision": "approve" } },
538
+ { "name": "off unless the app enables it", "text": "approve", "config": { "enabled": false }, "expect": null },
539
+ { "name": "no phrases until the host sets them", "text": "approve", "config": { "phrases": {} }, "expect": null },
540
+ { "name": "only a pending approval can be typed at", "text": "approve", "approvalState": "deciding", "expect": null },
541
+ { "name": "no once option of that decision means no match", "text": "reject", "options": [{ "id": "o_always", "kind": "allow-always", "label": "Always" }, { "id": "o_never", "kind": "reject-always", "label": "Never" }], "expect": null },
542
+ { "name": "edit is never typed", "text": "edit", "config": { "phrases": { "en": { "approve": ["approve"], "reject": ["reject"], "edit": ["edit"] } } }, "expect": null }
543
+ ]
544
+ },
545
+ "undo": {
546
+ "legs": ["js", "php"],
547
+ "cases": [
548
+ { "name": "time left in an open window", "entry": { "actionId": "a1", "label": "Email", "deadline": "2026-11-15T10:00:30.000Z", "state": "open" }, "now": "2026-11-15T10:00:10.000Z", "expect": { "remainingMs": 20000, "canRevert": true } },
549
+ { "name": "at the deadline the window is shut", "entry": { "actionId": "a1", "label": "Email", "deadline": "2026-11-15T10:00:30.000Z", "state": "open" }, "now": "2026-11-15T10:00:30.000Z", "expect": { "remainingMs": 0, "canRevert": false } },
550
+ { "name": "a committed action cannot be reverted", "entry": { "actionId": "a1", "label": "Email", "deadline": "2026-11-15T10:00:30.000Z", "state": "committed" }, "now": "2026-11-15T10:00:10.000Z", "expect": { "remainingMs": 0, "canRevert": false } },
551
+ { "name": "a deadline with no zone is shut, never read as local time", "entry": { "actionId": "a1", "label": "Email", "deadline": "2026-11-15 10:00:30", "state": "open" }, "now": "2026-11-15T10:00:10.000Z", "expect": { "remainingMs": 0, "canRevert": false } },
552
+ { "name": "an unreadable deadline is shut, never open", "entry": { "actionId": "a1", "label": "Email", "deadline": "soon", "state": "open" }, "now": "2026-11-15T10:00:10.000Z", "expect": { "remainingMs": 0, "canRevert": false } }
553
+ ]
554
+ },
555
+ "planStep": {
556
+ "legs": ["js", "php"],
557
+ "approvals": [
558
+ { "approvalId": "ap_ok", "state": "approved" },
559
+ { "approvalId": "ap_wait", "state": "pending" },
560
+ { "approvalId": "ap_busy", "state": "deciding" },
561
+ { "approvalId": "ap_no", "state": "rejected" },
562
+ { "approvalId": "ap_gone", "state": "withdrawn" }
563
+ ],
564
+ "cases": [
565
+ { "name": "a held step released after its approval", "prev": [{ "id": "s", "title": "Pay", "status": "held", "owner": "human", "approvalId": "ap_ok" }], "next": [{ "id": "s", "title": "Pay", "status": "running", "owner": "human", "approvalId": "ap_ok" }], "ok": true, "error": null },
566
+ { "name": "a held step cannot run while its approval is pending", "prev": [{ "id": "s", "title": "Pay", "status": "held", "owner": "human", "approvalId": "ap_wait" }], "next": [{ "id": "s", "title": "Pay", "status": "done", "owner": "human", "approvalId": "ap_wait" }], "ok": false, "error": "plan.held" },
567
+ { "name": "nor while it is being decided", "prev": [{ "id": "s", "title": "Pay", "status": "held", "owner": "human", "approvalId": "ap_busy" }], "next": [{ "id": "s", "title": "Pay", "status": "running", "owner": "human", "approvalId": "ap_busy" }], "ok": false, "error": "plan.held" },
568
+ { "name": "a held step with no approval cannot be released", "prev": [{ "id": "s", "title": "Pay", "status": "held", "owner": "human" }], "next": [{ "id": "s", "title": "Pay", "status": "running", "owner": "human" }], "ok": false, "error": "plan.held" },
569
+ { "name": "a rejected step may only be skipped or failed", "prev": [{ "id": "s", "title": "Pay", "status": "held", "owner": "human", "approvalId": "ap_no" }], "next": [{ "id": "s", "title": "Pay", "status": "skipped", "owner": "human", "approvalId": "ap_no" }], "ok": true, "error": null },
570
+ { "name": "a rejected step cannot run", "prev": [{ "id": "s", "title": "Pay", "status": "held", "owner": "human", "approvalId": "ap_no" }], "next": [{ "id": "s", "title": "Pay", "status": "running", "owner": "human", "approvalId": "ap_no" }], "ok": false, "error": "plan.held" },
571
+ { "name": "a withdrawn step cannot be done", "prev": [{ "id": "s", "title": "Pay", "status": "held", "owner": "human", "approvalId": "ap_gone" }], "next": [{ "id": "s", "title": "Pay", "status": "done", "owner": "human", "approvalId": "ap_gone" }], "ok": false, "error": "plan.held" },
572
+ { "name": "swapping the approval id does not release it", "prev": [{ "id": "s", "title": "Pay", "status": "held", "owner": "human", "approvalId": "ap_wait" }], "next": [{ "id": "s", "title": "Pay", "status": "running", "owner": "human", "approvalId": "ap_ok" }], "ok": false, "error": "plan.held" },
573
+ { "name": "dropping a held step releases nothing", "prev": [{ "id": "s", "title": "Pay", "status": "held", "owner": "human", "approvalId": "ap_wait" }], "next": [], "ok": false, "error": "plan.held" },
574
+ { "name": "a step may become held, and staying held is fine", "prev": [{ "id": "s", "title": "Pay", "status": "pending", "owner": "agent" }], "next": [{ "id": "s", "title": "Pay", "status": "held", "owner": "human", "approvalId": "ap_wait" }], "ok": true, "error": null },
575
+ { "name": "an unknown status is refused", "prev": [], "next": [{ "id": "s", "title": "Pay", "status": "paused", "owner": "agent" }], "ok": false, "error": "plan.step" },
576
+ { "name": "a null step is refused, never thrown on", "prev": [], "next": [null], "ok": false, "error": "plan.step" },
577
+ { "name": "a step that is not an object is refused", "prev": [], "next": ["x", 5], "ok": false, "error": "plan.step" }
578
+ ]
579
+ },
580
+ "branchTurns": {
581
+ "legs": ["js", "php"],
582
+ "about": "Under the truncate policy the server cancels every UNSETTLED turn the removed branch references: through a message in the branch (the superseded message included) or an approval placed in it. Settled turns and turns outside the branch are left alone.",
583
+ "events": [
584
+ { "seq": 1, "type": "message.created", "actor": { "kind": "human", "id": "u_1" }, "data": { "turnId": "u_first", "message": { "id": "m_1", "role": "user", "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "one" }], "delivery": "sent" } } },
585
+ { "seq": 2, "type": "turn.started", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_old" } },
586
+ { "seq": 3, "type": "turn.transition", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_old", "action": "start" } },
587
+ { "seq": 4, "type": "message.created", "actor": { "kind": "agent", "id": "compass" }, "data": { "turnId": "u_old", "message": { "id": "m_2", "role": "assistant", "parts": [] } } },
588
+ { "seq": 5, "type": "approval.requested", "actor": { "kind": "system", "id": "server" }, "data": { "approval": { "approvalId": "ap_1", "turnId": "u_side", "title": "Send?", "summary": "", "preview": [], "options": [{ "id": "o1", "kind": "allow-once", "label": "Send" }], "state": "pending" } } },
589
+ { "seq": 6, "type": "turn.started", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_side" } },
590
+ { "seq": 7, "type": "turn.transition", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_side", "action": "start" } },
591
+ { "seq": 8, "type": "turn.transition", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_side", "action": "park" } },
592
+ { "seq": 9, "type": "turn.transition", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_old", "action": "park" } },
593
+ { "seq": 10, "type": "message.created", "actor": { "kind": "agent", "id": "compass" }, "data": { "turnId": "u_done", "message": { "id": "m_3", "role": "assistant", "parts": [] } } },
594
+ { "seq": 11, "type": "turn.started", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_done" } },
595
+ { "seq": 12, "type": "turn.transition", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_done", "action": "start" } },
596
+ { "seq": 13, "type": "turn.settled", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_done", "action": "finish" } },
597
+ { "seq": 14, "type": "turn.started", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_outside" } },
598
+ { "seq": 15, "type": "turn.started", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_first" } },
599
+ { "seq": 16, "type": "turn.transition", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_first", "action": "start" } },
600
+ { "seq": 17, "type": "turn.transition", "actor": { "kind": "system", "id": "server" }, "data": { "turnId": "u_first", "action": "park" } },
601
+ { "seq": 18, "type": "message.created", "actor": { "kind": "human", "id": "u_1" }, "data": { "message": { "id": "m_4", "role": "user", "parts": [{ "id": "p", "kind": "text", "format": "plain", "text": "one, edited" }], "delivery": "sent", "supersedes": "m_1" } } }
602
+ ],
603
+ "cases": [
604
+ { "name": "parked turns in the branch, through a message (the superseded one included) or an approval; never a settled one or one outside", "supersededId": "m_1", "expect": ["u_old", "u_side", "u_first"] },
605
+ { "name": "a message with no branch cancels nothing", "supersededId": "m_404", "expect": [] }
606
+ ]
607
+ },
608
+ "sequence": {
609
+ "legs": ["js"],
610
+ "cases": [
611
+ { "name": "in order", "batches": [[1, 2, 3]], "expect": { "lastSeq": 3, "applied": [1, 2, 3], "missing": null } },
612
+ { "name": "duplicates dropped", "batches": [[1, 2], [2, 2, 3, 1]], "expect": { "lastSeq": 3, "applied": [1, 2, 3], "missing": null } },
613
+ { "name": "a gap is held and reported", "batches": [[1, 2, 5, 6]], "expect": { "lastSeq": 2, "applied": [1, 2], "missing": { "after": 2, "before": 5 } } },
614
+ { "name": "the gap fills and the held events release in order", "batches": [[1, 2, 5, 6], [4, 3]], "expect": { "lastSeq": 6, "applied": [1, 2, 3, 4, 5, 6], "missing": null } },
615
+ { "name": "resume from a cursor", "start": 10, "batches": [[9, 10, 11, 12]], "expect": { "lastSeq": 12, "applied": [11, 12], "missing": null } },
616
+ { "name": "a reset jumps the cursor and discards held events at or below it", "batches": [[1, 4], [{ "seq": 7, "type": "thread.reset" }, 8]], "expect": { "lastSeq": 8, "applied": [1, 7, 8], "missing": null } }
617
+ ]
618
+ }
619
+ }