@mhome/conversation-protocol 4.0.0 → 4.3.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.
package/README.md CHANGED
@@ -7,6 +7,11 @@ conversation events. `ConversationSurface` is a canonical value object whose str
7
7
  wire and persistence identity of one isolated conversation endpoint. The crate deliberately
8
8
  contains no Agent runtime, persistence, transport implementation, or messaging-provider SDK.
9
9
 
10
+ `ThreadSync` returns unchanged, delta, or full-snapshot state. Rust stores the
11
+ full snapshot in `Box<ThreadSnapshot>` so the other variants remain compact.
12
+ The JSON response still contains the snapshot object directly; the allocation
13
+ does not change its fields, synchronization behavior, or schema.
14
+
10
15
  `/chat/turn/submit` is the source-neutral application operation for callers that do not manage
11
16
  threads themselves. The Conversation implementation owns active-thread creation, idle rotation,
12
17
  pending-interaction policy, idempotency, and enqueueing for that operation.
@@ -50,6 +55,15 @@ data. The UI operates on that exact session. A status check returns its actual r
50
55
  only a new tool call can request further human interaction. Prepared approvals retain their
51
56
  business prepare/commit contract. Card state and responses are separate from model history.
52
57
 
58
+ The Conversation backend accepts a nonempty subset of distinct known item answers, persists
59
+ partial responses privately with their responder identities, and resumes Runtime only after
60
+ all items are answered. Public `PendingInteraction.answeredActionIds` is required and carries
61
+ only progress. Clients show the first unanswered item and advance after canonical acknowledgement.
62
+ Identical retries by the same responder are idempotent; accepted answers cannot be edited.
63
+ Runtime's execution command still carries the complete batch. User actions may open a shared
64
+ frontend Operation that performs its business writes before returning a safe result. The
65
+ saved handler validates or reads that result rather than repeating the write.
66
+
53
67
  `RunErrorCode` is the closed catalog for `runOutcome.errorCode` and Agent `Failed.code`. Host
54
68
  terminalize and Agent failures emit the same strings. `status` and `failure.source` are properties
55
69
  of the code; `failure.code` equals `errorCode`. User-visible copy stays in `runOutcome.message`,
@@ -71,6 +85,13 @@ adopted by Lion and Cloud together before deployment.
71
85
 
72
86
  Execution commands, events, facade responses and their typed nested objects reject undeclared fields, including null-valued unknown fields. Opaque JSON inputs/results and model continuation payloads remain extensible; known optional null fields remain accepted. Enforcement lives on the typed DTOs as well as the wire entry point because Serde's internally tagged enum buffering bypasses an outer `serde_ignored` observer. Tagged unit variants explicitly require an empty remaining map. The enclosing wire envelope retains version 1; callers must adopt the current package contract together.
73
87
 
88
+ `fixtures/response/conformance.json` defines valid and invalid final Facade
89
+ responses for all four outcomes. Rust verifies the typed response and complete
90
+ execution envelope; strict AJV verifies both the execution envelope and the
91
+ standalone App Facade response schema against the same cases. The npm protocol
92
+ descriptor exposes these cases as `fixtures.facadeResponse`. The embedded response
93
+ definition must match the standalone schema after rebasing its local references.
94
+
74
95
  ## Disposable execution presentation
75
96
 
76
97
  `assistant.preview`, `run.progress`, and `run.system_failed` are best-effort live
@@ -40,7 +40,8 @@
40
40
  "input": {
41
41
  "capability": "device.turn_on",
42
42
  "device_id": "device-1"
43
- }
43
+ },
44
+ "response_detail": "full"
44
45
  }
45
46
  }
46
47
  }
@@ -33,7 +33,8 @@
33
33
  }
34
34
  }
35
35
  }
36
- ]
36
+ ],
37
+ "answeredActionIds": []
37
38
  },
38
39
  "runOutcome": {
39
40
  "requestId": "request-1",
@@ -0,0 +1,549 @@
1
+ {
2
+ "valid": [
3
+ {
4
+ "name": "success data object",
5
+ "value": {
6
+ "status": "success",
7
+ "data": {
8
+ "ids": [
9
+ "a"
10
+ ]
11
+ }
12
+ }
13
+ },
14
+ {
15
+ "name": "success data null",
16
+ "value": {
17
+ "status": "success",
18
+ "data": null
19
+ }
20
+ },
21
+ {
22
+ "name": "success data boolean",
23
+ "value": {
24
+ "status": "success",
25
+ "data": false
26
+ }
27
+ },
28
+ {
29
+ "name": "success data number",
30
+ "value": {
31
+ "status": "success",
32
+ "data": 0
33
+ }
34
+ },
35
+ {
36
+ "name": "success data array",
37
+ "value": {
38
+ "status": "success",
39
+ "data": []
40
+ }
41
+ },
42
+ {
43
+ "name": "success data string",
44
+ "value": {
45
+ "status": "success",
46
+ "data": "value"
47
+ }
48
+ },
49
+ {
50
+ "name": "success empty text",
51
+ "value": {
52
+ "status": "success",
53
+ "text": "",
54
+ "warnings": [
55
+ {
56
+ "code": "STALE",
57
+ "message": "Cached state",
58
+ "details": {
59
+ "source": "cloud"
60
+ }
61
+ }
62
+ ]
63
+ }
64
+ },
65
+ {
66
+ "name": "success YAML text",
67
+ "value": {
68
+ "status": "success",
69
+ "text": "ids:\n- a\n",
70
+ "warnings": [
71
+ {
72
+ "code": "STALE",
73
+ "message": "Cached state",
74
+ "details": {
75
+ "source": "cloud"
76
+ }
77
+ }
78
+ ]
79
+ }
80
+ },
81
+ {
82
+ "name": "success opaque data",
83
+ "value": {
84
+ "status": "success",
85
+ "data": {
86
+ "status": "failed",
87
+ "success": false,
88
+ "text": null
89
+ },
90
+ "warnings": []
91
+ }
92
+ },
93
+ {
94
+ "name": "partial data object",
95
+ "value": {
96
+ "status": "partial",
97
+ "data": {
98
+ "ids": [
99
+ "a"
100
+ ]
101
+ }
102
+ }
103
+ },
104
+ {
105
+ "name": "partial data null",
106
+ "value": {
107
+ "status": "partial",
108
+ "data": null
109
+ }
110
+ },
111
+ {
112
+ "name": "partial data boolean",
113
+ "value": {
114
+ "status": "partial",
115
+ "data": false
116
+ }
117
+ },
118
+ {
119
+ "name": "partial data number",
120
+ "value": {
121
+ "status": "partial",
122
+ "data": 0
123
+ }
124
+ },
125
+ {
126
+ "name": "partial data array",
127
+ "value": {
128
+ "status": "partial",
129
+ "data": []
130
+ }
131
+ },
132
+ {
133
+ "name": "partial data string",
134
+ "value": {
135
+ "status": "partial",
136
+ "data": "value"
137
+ }
138
+ },
139
+ {
140
+ "name": "partial empty text",
141
+ "value": {
142
+ "status": "partial",
143
+ "text": "",
144
+ "warnings": [
145
+ {
146
+ "code": "STALE",
147
+ "message": "Cached state",
148
+ "details": {
149
+ "source": "cloud"
150
+ }
151
+ }
152
+ ]
153
+ }
154
+ },
155
+ {
156
+ "name": "partial YAML text",
157
+ "value": {
158
+ "status": "partial",
159
+ "text": "ids:\n- a\n",
160
+ "warnings": [
161
+ {
162
+ "code": "STALE",
163
+ "message": "Cached state",
164
+ "details": {
165
+ "source": "cloud"
166
+ }
167
+ }
168
+ ]
169
+ }
170
+ },
171
+ {
172
+ "name": "partial opaque data",
173
+ "value": {
174
+ "status": "partial",
175
+ "data": {
176
+ "status": "failed",
177
+ "success": false,
178
+ "text": null
179
+ },
180
+ "warnings": []
181
+ }
182
+ },
183
+ {
184
+ "name": "error",
185
+ "value": {
186
+ "status": "error",
187
+ "error": {
188
+ "code": "CONFLICT",
189
+ "message": "Changed"
190
+ }
191
+ }
192
+ },
193
+ {
194
+ "name": "error diagnostics",
195
+ "value": {
196
+ "status": "error",
197
+ "error": {
198
+ "code": "CONFLICT",
199
+ "message": "Changed",
200
+ "details": {
201
+ "cause": {
202
+ "revision": 3
203
+ },
204
+ "warnings": [
205
+ {
206
+ "code": "STALE",
207
+ "message": "Cached state",
208
+ "details": {
209
+ "source": "cloud"
210
+ }
211
+ }
212
+ ],
213
+ "context": "Retry after reading state"
214
+ }
215
+ }
216
+ }
217
+ },
218
+ {
219
+ "name": "error null details",
220
+ "value": {
221
+ "status": "error",
222
+ "error": {
223
+ "code": "E",
224
+ "message": "failed",
225
+ "details": null
226
+ }
227
+ }
228
+ },
229
+ {
230
+ "name": "cancelled",
231
+ "value": {
232
+ "status": "cancelled"
233
+ }
234
+ },
235
+ {
236
+ "name": "cancelled cleanup warning",
237
+ "value": {
238
+ "status": "cancelled",
239
+ "warnings": [
240
+ {
241
+ "code": "STALE",
242
+ "message": "Cached state",
243
+ "details": {
244
+ "source": "cloud"
245
+ }
246
+ }
247
+ ]
248
+ }
249
+ },
250
+ {
251
+ "name": "cancelled empty warnings",
252
+ "value": {
253
+ "status": "cancelled",
254
+ "warnings": []
255
+ }
256
+ }
257
+ ],
258
+ "invalid": [
259
+ {
260
+ "name": "success no content",
261
+ "value": {
262
+ "status": "success"
263
+ }
264
+ },
265
+ {
266
+ "name": "success both contents",
267
+ "value": {
268
+ "status": "success",
269
+ "data": {},
270
+ "text": "text"
271
+ }
272
+ },
273
+ {
274
+ "name": "success null data and text",
275
+ "value": {
276
+ "status": "success",
277
+ "data": null,
278
+ "text": ""
279
+ }
280
+ },
281
+ {
282
+ "name": "success null text",
283
+ "value": {
284
+ "status": "success",
285
+ "text": null
286
+ }
287
+ },
288
+ {
289
+ "name": "success number text",
290
+ "value": {
291
+ "status": "success",
292
+ "text": 2
293
+ }
294
+ },
295
+ {
296
+ "name": "success unknown property",
297
+ "value": {
298
+ "status": "success",
299
+ "data": {},
300
+ "extra": null
301
+ }
302
+ },
303
+ {
304
+ "name": "success error field",
305
+ "value": {
306
+ "status": "success",
307
+ "data": {},
308
+ "error": {
309
+ "code": "E",
310
+ "message": "bad"
311
+ }
312
+ }
313
+ },
314
+ {
315
+ "name": "success null warnings",
316
+ "value": {
317
+ "status": "success",
318
+ "data": {},
319
+ "warnings": null
320
+ }
321
+ },
322
+ {
323
+ "name": "success invalid warning",
324
+ "value": {
325
+ "status": "success",
326
+ "data": {},
327
+ "warnings": [
328
+ {
329
+ "code": "W"
330
+ }
331
+ ]
332
+ }
333
+ },
334
+ {
335
+ "name": "success unknown warning property",
336
+ "value": {
337
+ "status": "success",
338
+ "data": {},
339
+ "warnings": [
340
+ {
341
+ "code": "W",
342
+ "message": "warning",
343
+ "extra": null
344
+ }
345
+ ]
346
+ }
347
+ },
348
+ {
349
+ "name": "partial no content",
350
+ "value": {
351
+ "status": "partial"
352
+ }
353
+ },
354
+ {
355
+ "name": "partial both contents",
356
+ "value": {
357
+ "status": "partial",
358
+ "data": {},
359
+ "text": "text"
360
+ }
361
+ },
362
+ {
363
+ "name": "partial null data and text",
364
+ "value": {
365
+ "status": "partial",
366
+ "data": null,
367
+ "text": ""
368
+ }
369
+ },
370
+ {
371
+ "name": "partial null text",
372
+ "value": {
373
+ "status": "partial",
374
+ "text": null
375
+ }
376
+ },
377
+ {
378
+ "name": "partial number text",
379
+ "value": {
380
+ "status": "partial",
381
+ "text": 2
382
+ }
383
+ },
384
+ {
385
+ "name": "partial unknown property",
386
+ "value": {
387
+ "status": "partial",
388
+ "data": {},
389
+ "extra": null
390
+ }
391
+ },
392
+ {
393
+ "name": "partial error field",
394
+ "value": {
395
+ "status": "partial",
396
+ "data": {},
397
+ "error": {
398
+ "code": "E",
399
+ "message": "bad"
400
+ }
401
+ }
402
+ },
403
+ {
404
+ "name": "partial null warnings",
405
+ "value": {
406
+ "status": "partial",
407
+ "data": {},
408
+ "warnings": null
409
+ }
410
+ },
411
+ {
412
+ "name": "partial invalid warning",
413
+ "value": {
414
+ "status": "partial",
415
+ "data": {},
416
+ "warnings": [
417
+ {
418
+ "code": "W"
419
+ }
420
+ ]
421
+ }
422
+ },
423
+ {
424
+ "name": "partial unknown warning property",
425
+ "value": {
426
+ "status": "partial",
427
+ "data": {},
428
+ "warnings": [
429
+ {
430
+ "code": "W",
431
+ "message": "warning",
432
+ "extra": null
433
+ }
434
+ ]
435
+ }
436
+ },
437
+ {
438
+ "name": "error without problem",
439
+ "value": {
440
+ "status": "error"
441
+ }
442
+ },
443
+ {
444
+ "name": "error without code",
445
+ "value": {
446
+ "status": "error",
447
+ "error": {
448
+ "message": "bad"
449
+ }
450
+ }
451
+ },
452
+ {
453
+ "name": "error with unknown field",
454
+ "value": {
455
+ "status": "error",
456
+ "error": {
457
+ "code": "E",
458
+ "message": "bad",
459
+ "extra": null
460
+ }
461
+ }
462
+ },
463
+ {
464
+ "name": "error with data",
465
+ "value": {
466
+ "status": "error",
467
+ "error": {
468
+ "code": "E",
469
+ "message": "bad"
470
+ },
471
+ "data": null
472
+ }
473
+ },
474
+ {
475
+ "name": "error with text",
476
+ "value": {
477
+ "status": "error",
478
+ "error": {
479
+ "code": "E",
480
+ "message": "bad"
481
+ },
482
+ "text": ""
483
+ }
484
+ },
485
+ {
486
+ "name": "error with warnings",
487
+ "value": {
488
+ "status": "error",
489
+ "error": {
490
+ "code": "E",
491
+ "message": "bad"
492
+ },
493
+ "warnings": []
494
+ }
495
+ },
496
+ {
497
+ "name": "cancelled with data",
498
+ "value": {
499
+ "status": "cancelled",
500
+ "data": null
501
+ }
502
+ },
503
+ {
504
+ "name": "cancelled with text",
505
+ "value": {
506
+ "status": "cancelled",
507
+ "text": ""
508
+ }
509
+ },
510
+ {
511
+ "name": "cancelled with error",
512
+ "value": {
513
+ "status": "cancelled",
514
+ "error": {
515
+ "code": "E",
516
+ "message": "bad"
517
+ }
518
+ }
519
+ },
520
+ {
521
+ "name": "cancelled with null warnings",
522
+ "value": {
523
+ "status": "cancelled",
524
+ "warnings": null
525
+ }
526
+ },
527
+ {
528
+ "name": "missing status",
529
+ "value": {
530
+ "data": {}
531
+ }
532
+ },
533
+ {
534
+ "name": "unknown status",
535
+ "value": {
536
+ "status": "done",
537
+ "data": {}
538
+ }
539
+ },
540
+ {
541
+ "name": "non object",
542
+ "value": []
543
+ },
544
+ {
545
+ "name": "null response",
546
+ "value": null
547
+ }
548
+ ]
549
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.conversation.targets.v1",
3
- "contractVersion": "4.0.0",
3
+ "contractVersion": "4.3.0",
4
4
  "requestTargets": [
5
5
  "/chat/control/get",
6
6
  "/chat/thread/list",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mhome/conversation-protocol",
3
- "version": "4.0.0",
3
+ "version": "4.3.0",
4
4
  "description": "Build-time protocol artifacts for mhome.conversation",
5
5
  "license": "MIT",
6
6
  "repository": {
package/protocol.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "protocol": "mhome.conversation",
3
- "contractVersion": "4.0.0",
3
+ "contractVersion": "4.3.0",
4
4
  "manifest": "manifest/targets.v1.json",
5
5
  "schemas": {
6
6
  "frame": "schema/conversation-frame.v2.schema.json",
@@ -8,6 +8,7 @@
8
8
  "podTalk": "schema/pod-talk.v1.schema.json"
9
9
  },
10
10
  "fixtures": {
11
- "valid": "fixtures"
11
+ "valid": "fixtures",
12
+ "facadeResponse": "fixtures/response/conformance.json"
12
13
  }
13
14
  }
@@ -132,7 +132,8 @@
132
132
  "batchId",
133
133
  "title",
134
134
  "message",
135
- "items"
135
+ "items",
136
+ "answeredActionIds"
136
137
  ],
137
138
  "properties": {
138
139
  "requestId": {
@@ -153,6 +154,13 @@
153
154
  "items": {
154
155
  "$ref": "#/$defs/interactionItem"
155
156
  }
157
+ },
158
+ "answeredActionIds": {
159
+ "type": "array",
160
+ "uniqueItems": true,
161
+ "items": {
162
+ "$ref": "#/$defs/id"
163
+ }
156
164
  }
157
165
  }
158
166
  },
@@ -1132,7 +1132,8 @@
1132
1132
  "required": [
1133
1133
  "operation_id",
1134
1134
  "target",
1135
- "input"
1135
+ "input",
1136
+ "response_detail"
1136
1137
  ],
1137
1138
  "properties": {
1138
1139
  "operation_id": {
@@ -1141,7 +1142,14 @@
1141
1142
  "target": {
1142
1143
  "$ref": "#/$defs/identifier"
1143
1144
  },
1144
- "input": true
1145
+ "input": true,
1146
+ "response_detail": {
1147
+ "enum": [
1148
+ "full",
1149
+ "essential"
1150
+ ],
1151
+ "default": "full"
1152
+ }
1145
1153
  }
1146
1154
  },
1147
1155
  "app_facade_request": {
@@ -1214,7 +1222,9 @@
1214
1222
  "value"
1215
1223
  ],
1216
1224
  "properties": {
1217
- "value": true,
1225
+ "value": {
1226
+ "$ref": "#/$defs/facade_response"
1227
+ },
1218
1228
  "context_invalidation": {
1219
1229
  "type": "object",
1220
1230
  "additionalProperties": false,
@@ -2054,6 +2064,144 @@
2054
2064
  ]
2055
2065
  }
2056
2066
  }
2067
+ },
2068
+ "facade_response": {
2069
+ "title": "App Facade final response",
2070
+ "oneOf": [
2071
+ {
2072
+ "type": "object",
2073
+ "additionalProperties": false,
2074
+ "required": [
2075
+ "status"
2076
+ ],
2077
+ "properties": {
2078
+ "status": {
2079
+ "const": "success"
2080
+ },
2081
+ "data": true,
2082
+ "text": {
2083
+ "type": "string"
2084
+ },
2085
+ "warnings": {
2086
+ "type": "array",
2087
+ "items": {
2088
+ "$ref": "#/$defs/facade_response/$defs/problem"
2089
+ }
2090
+ }
2091
+ },
2092
+ "oneOf": [
2093
+ {
2094
+ "required": [
2095
+ "data"
2096
+ ],
2097
+ "properties": {
2098
+ "data": true
2099
+ }
2100
+ },
2101
+ {
2102
+ "required": [
2103
+ "text"
2104
+ ],
2105
+ "properties": {
2106
+ "text": true
2107
+ }
2108
+ }
2109
+ ]
2110
+ },
2111
+ {
2112
+ "type": "object",
2113
+ "additionalProperties": false,
2114
+ "required": [
2115
+ "status"
2116
+ ],
2117
+ "properties": {
2118
+ "status": {
2119
+ "const": "partial"
2120
+ },
2121
+ "data": true,
2122
+ "text": {
2123
+ "type": "string"
2124
+ },
2125
+ "warnings": {
2126
+ "type": "array",
2127
+ "items": {
2128
+ "$ref": "#/$defs/facade_response/$defs/problem"
2129
+ }
2130
+ }
2131
+ },
2132
+ "oneOf": [
2133
+ {
2134
+ "required": [
2135
+ "data"
2136
+ ],
2137
+ "properties": {
2138
+ "data": true
2139
+ }
2140
+ },
2141
+ {
2142
+ "required": [
2143
+ "text"
2144
+ ],
2145
+ "properties": {
2146
+ "text": true
2147
+ }
2148
+ }
2149
+ ]
2150
+ },
2151
+ {
2152
+ "type": "object",
2153
+ "additionalProperties": false,
2154
+ "required": [
2155
+ "status",
2156
+ "error"
2157
+ ],
2158
+ "properties": {
2159
+ "status": {
2160
+ "const": "error"
2161
+ },
2162
+ "error": {
2163
+ "$ref": "#/$defs/facade_response/$defs/problem"
2164
+ }
2165
+ }
2166
+ },
2167
+ {
2168
+ "type": "object",
2169
+ "additionalProperties": false,
2170
+ "required": [
2171
+ "status"
2172
+ ],
2173
+ "properties": {
2174
+ "status": {
2175
+ "const": "cancelled"
2176
+ },
2177
+ "warnings": {
2178
+ "type": "array",
2179
+ "items": {
2180
+ "$ref": "#/$defs/facade_response/$defs/problem"
2181
+ }
2182
+ }
2183
+ }
2184
+ }
2185
+ ],
2186
+ "$defs": {
2187
+ "problem": {
2188
+ "type": "object",
2189
+ "additionalProperties": false,
2190
+ "required": [
2191
+ "code",
2192
+ "message"
2193
+ ],
2194
+ "properties": {
2195
+ "code": {
2196
+ "type": "string"
2197
+ },
2198
+ "message": {
2199
+ "type": "string"
2200
+ },
2201
+ "details": true
2202
+ }
2203
+ }
2204
+ }
2057
2205
  }
2058
2206
  }
2059
2207
  }