@mhome/conversation-protocol 3.16.0 → 4.1.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.
@@ -40,12 +45,24 @@ Model data is re-exported from `llm-api`; there is one model-message representat
40
45
  messages intentionally use separate content types and never contain private model continuation.
41
46
  Runtime state machines, checkpoint formats, prompts and recovery policy remain in Agent Runtime.
42
47
 
43
- Connection HITL previews resume one exact lifecycle session:
44
- `{ "type": "connect_integration", "integrationId": "provider.example", "sessionId": "session" }`.
45
- The execution and conversation contracts use the same closed client-task shape.
46
- The UI reads and resumes that session; it never starts a replacement on reopening.
47
- The Agent verifies its authoritative completion result and Connection ID. Expired
48
- or lost sessions fail explicitly. Direct installation confirmations have no client task.
48
+ HITL items share one public card contract: `kind` selects approval or user action; `card.type`
49
+ selects trusted frontend presentation and `card.data` retains structured business data. Approval
50
+ responses use approve/reject. User-action responses use continue with required `data` (null when
51
+ no input is needed), or cancel. Public and execution requests carry the same typed `responses`.
52
+ A saved tool handler produces one final result after acceptance; `FacadeResult` cannot suspend.
53
+ Integration connection cards use `integration.connect` with `integrationId` and `sessionId` in
54
+ data. The UI operates on that exact session. A status check returns its actual result once;
55
+ only a new tool call can request further human interaction. Prepared approvals retain their
56
+ business prepare/commit contract. Card state and responses are separate from model history.
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.
49
66
 
50
67
  `RunErrorCode` is the closed catalog for `runOutcome.errorCode` and Agent `Failed.code`. Host
51
68
  terminalize and Agent failures emit the same strings. `status` and `failure.source` are properties
@@ -66,7 +83,7 @@ adopted by Lion and Cloud together before deployment.
66
83
 
67
84
  ### Strict execution envelope decoding
68
85
 
69
- 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. This restores the existing wire-v1 contract without changing its message shape or major version.
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.
70
87
 
71
88
  ## Disposable execution presentation
72
89
 
@@ -141,7 +158,7 @@ settlement; archived-thread results never replace a different active view.
141
158
  Reply offsets count UTF-8 bytes in the immutable plain text identified by
142
159
  `contentRevision`. A single bounded window includes explicit next/previous
143
160
  offsets. Pending previews mark omissions and prohibit approving incomplete
144
- previews or unsupported client tasks. Spoken responses target the original
161
+ cards or unsupported user actions. Spoken responses target the original
145
162
  thread, request and batch, with a second validation before canonical submission.
146
163
 
147
164
  The complete escaped MWS frame is limited to 64 KiB, changed notifications to
@@ -17,35 +17,22 @@
17
17
  "action": {
18
18
  "action_id": "action-1",
19
19
  "operation_id": "run-1:step:0:tool:call-1",
20
- "preview": {
21
- "actionCode": "device.power.update",
22
- "title": "Turn on device",
23
- "message": "Turn on the kitchen light.",
24
- "tone": "normal",
25
- "details": [
26
- {
27
- "label": "Device",
28
- "value": {
29
- "type": "text",
30
- "text": "Kitchen light"
31
- }
32
- },
33
- {
34
- "label": "Power",
35
- "value": {
36
- "type": "bool",
37
- "value": true
38
- }
39
- }
40
- ],
41
- "proceedLabel": "Continue",
42
- "rejectLabel": "Cancel"
43
- },
44
20
  "payload": {
45
21
  "target": "/app/capability/invoke"
46
22
  },
47
23
  "revision": 7,
48
- "interaction_kind": "approval"
24
+ "card": {
25
+ "type": "device.power.update",
26
+ "title": "Turn on device",
27
+ "message": "Turn on the kitchen light.",
28
+ "tone": "normal",
29
+ "continueLabel": "Continue",
30
+ "cancelLabel": "Cancel",
31
+ "data": {
32
+ "Device": "Kitchen light",
33
+ "Power": true
34
+ }
35
+ }
49
36
  }
50
37
  }
51
38
  }
@@ -39,26 +39,6 @@
39
39
  "event": {
40
40
  "type": "interaction_required",
41
41
  "batch_id": "batch-1",
42
- "actions": [
43
- {
44
- "action_id": "action-1",
45
- "operation_id": "operation-1",
46
- "preview": {
47
- "actionCode": "dashboard.canvas.delete",
48
- "title": "Delete canvas",
49
- "message": "Delete this canvas?",
50
- "tone": "danger",
51
- "details": [],
52
- "proceedLabel": "Delete",
53
- "rejectLabel": "Cancel"
54
- },
55
- "payload": {
56
- "canvasId": "canvas-1"
57
- },
58
- "revision": 1,
59
- "interaction_kind": "approval"
60
- }
61
- ],
62
42
  "usage": {
63
43
  "model_requests": 2,
64
44
  "reported_model_requests": 2,
@@ -71,7 +51,25 @@
71
51
  "tool_calls": 1,
72
52
  "window_truncations": 0,
73
53
  "trimmed_messages": 0
74
- }
54
+ },
55
+ "items": [
56
+ {
57
+ "item": {
58
+ "actionId": "action-1",
59
+ "kind": "approval",
60
+ "card": {
61
+ "type": "dashboard.canvas.delete",
62
+ "title": "Delete canvas",
63
+ "message": "Delete this canvas?",
64
+ "tone": "danger",
65
+ "continueLabel": "Delete",
66
+ "cancelLabel": "Cancel",
67
+ "data": {}
68
+ }
69
+ },
70
+ "prepared_action_id": "action-1"
71
+ }
72
+ ]
75
73
  }
76
74
  },
77
75
  "checkpoint": {
@@ -0,0 +1,85 @@
1
+ {
2
+ "metadata": {
3
+ "version": 1,
4
+ "message_id": "message-2",
5
+ "correlation_id": "correlation-1",
6
+ "causation_id": "message-1",
7
+ "sent_at_unix_ms": 1700000001000,
8
+ "dispatch": {
9
+ "dispatch_id": "dispatch-1",
10
+ "agent_session_id": "agent-session-1"
11
+ }
12
+ },
13
+ "payload": {
14
+ "family": "event",
15
+ "payload": {
16
+ "event": {
17
+ "id": "event-1",
18
+ "sequence": 2,
19
+ "context": {
20
+ "scope": {
21
+ "tenant_id": "tenant-1",
22
+ "scope_id": "scope-1"
23
+ },
24
+ "actor": {
25
+ "principal": {
26
+ "kind": "user",
27
+ "userId": "user-1"
28
+ },
29
+ "client_id": "client-1",
30
+ "credential_id": null
31
+ },
32
+ "thread_id": "thread-1",
33
+ "run_id": "run-1",
34
+ "operation_id": "operation-1",
35
+ "deadline_unix_ms": null,
36
+ "traceparent": null,
37
+ "surface_id": "cs1:cp:dXNlci0x"
38
+ },
39
+ "event": {
40
+ "type": "interaction_required",
41
+ "batch_id": "batch-1",
42
+ "usage": {
43
+ "model_requests": 2,
44
+ "reported_model_requests": 2,
45
+ "input_tokens": 30,
46
+ "output_tokens": 6,
47
+ "cached_input_tokens": null,
48
+ "reasoning_output_tokens": null,
49
+ "peak_input_tokens": 20,
50
+ "credits": 3,
51
+ "tool_calls": 1,
52
+ "window_truncations": 0,
53
+ "trimmed_messages": 0
54
+ },
55
+ "items": [
56
+ {
57
+ "item": {
58
+ "actionId": "action-1",
59
+ "kind": "user_action",
60
+ "card": {
61
+ "type": "integration.connect",
62
+ "title": "Connect Integration",
63
+ "message": "Complete this connection.",
64
+ "tone": "normal",
65
+ "continueLabel": "Done",
66
+ "cancelLabel": "Cancel",
67
+ "data": {
68
+ "integrationId": "provider.example",
69
+ "sessionId": "connection-session"
70
+ }
71
+ }
72
+ },
73
+ "prepared_action_id": null
74
+ }
75
+ ]
76
+ }
77
+ },
78
+ "checkpoint": {
79
+ "object_key": "checkpoints/abc.json",
80
+ "sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
81
+ "format_version": 1
82
+ }
83
+ }
84
+ }
85
+ }
@@ -4,9 +4,14 @@
4
4
  "body": {
5
5
  "requestId": "request-1",
6
6
  "batchId": "batch-1",
7
- "decisions": [
8
- { "actionId": "action-1", "decision": "approve" }
9
- ],
10
- "occurredAtUnixMs": 1787587200000
7
+ "occurredAtUnixMs": 1787587200000,
8
+ "responses": [
9
+ {
10
+ "actionId": "action-1",
11
+ "response": {
12
+ "action": "approve"
13
+ }
14
+ }
15
+ ]
11
16
  }
12
17
  }
@@ -21,19 +21,26 @@
21
21
  {
22
22
  "actionId": "action-1",
23
23
  "kind": "approval",
24
- "preview": {
25
- "actionCode": "room.delete",
24
+ "card": {
25
+ "type": "room.delete",
26
26
  "title": "Delete room",
27
27
  "message": "Delete room Kitchen",
28
28
  "tone": "danger",
29
- "details": [{ "label": "Room", "value": { "type": "text", "text": "Kitchen" } }],
30
- "proceedLabel": "Delete",
31
- "rejectLabel": "Cancel"
29
+ "continueLabel": "Delete",
30
+ "cancelLabel": "Cancel",
31
+ "data": {
32
+ "Room": "Kitchen"
33
+ }
32
34
  }
33
35
  }
34
- ]
36
+ ],
37
+ "answeredActionIds": []
35
38
  },
36
- "runOutcome": { "requestId": "request-1", "status": "interaction_required", "failure": null }
39
+ "runOutcome": {
40
+ "requestId": "request-1",
41
+ "status": "interaction_required",
42
+ "failure": null
43
+ }
37
44
  }
38
45
  }
39
46
  }
@@ -4,8 +4,13 @@
4
4
  "body": {
5
5
  "threadId": "thread-2",
6
6
  "batchId": "batch-1",
7
- "decisions": [
8
- { "actionId": "action-1", "decision": "approve" }
7
+ "responses": [
8
+ {
9
+ "actionId": "action-1",
10
+ "response": {
11
+ "action": "approve"
12
+ }
13
+ }
9
14
  ]
10
15
  }
11
16
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.conversation.targets.v1",
3
- "contractVersion": "3.16.0",
3
+ "contractVersion": "4.1.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": "3.16.0",
3
+ "version": "4.1.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": "3.16.0",
3
+ "contractVersion": "4.1.0",
4
4
  "manifest": "manifest/targets.v1.json",
5
5
  "schemas": {
6
6
  "frame": "schema/conversation-frame.v2.schema.json",