@mhome/conversation-protocol 3.15.0 → 4.0.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
@@ -40,13 +40,15 @@ Model data is re-exported from `llm-api`; there is one model-message representat
40
40
  messages intentionally use separate content types and never contain private model continuation.
41
41
  Runtime state machines, checkpoint formats, prompts and recovery policy remain in Agent Runtime.
42
42
 
43
- Installation HITL previews use exactly one concrete target:
44
- `{ "type": "install_integration", "integrationId": "provider.example" }`.
45
- The same closed client-task contract is used by execution and conversation frames.
46
- The old plural task and array field are rejected; producers and consumers must
47
- adopt this contract together. A confirmation for direct installation has no client task; the Agent Tool decides
48
- whether its trusted access mode requires that confirmation. Connection tasks open the existing connection UI, then
49
- the prepared action verifies authoritative installation state when the user continues.
43
+ HITL items share one public card contract: `kind` selects approval or user action; `card.type`
44
+ selects trusted frontend presentation and `card.data` retains structured business data. Approval
45
+ responses use approve/reject. User-action responses use continue with required `data` (null when
46
+ no input is needed), or cancel. Public and execution requests carry the same typed `responses`.
47
+ A saved tool handler produces one final result after acceptance; `FacadeResult` cannot suspend.
48
+ Integration connection cards use `integration.connect` with `integrationId` and `sessionId` in
49
+ data. The UI operates on that exact session. A status check returns its actual result once;
50
+ only a new tool call can request further human interaction. Prepared approvals retain their
51
+ business prepare/commit contract. Card state and responses are separate from model history.
50
52
 
51
53
  `RunErrorCode` is the closed catalog for `runOutcome.errorCode` and Agent `Failed.code`. Host
52
54
  terminalize and Agent failures emit the same strings. `status` and `failure.source` are properties
@@ -67,7 +69,7 @@ adopted by Lion and Cloud together before deployment.
67
69
 
68
70
  ### Strict execution envelope decoding
69
71
 
70
- 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.
72
+ 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.
71
73
 
72
74
  ## Disposable execution presentation
73
75
 
@@ -142,7 +144,7 @@ settlement; archived-thread results never replace a different active view.
142
144
  Reply offsets count UTF-8 bytes in the immutable plain text identified by
143
145
  `contentRevision`. A single bounded window includes explicit next/previous
144
146
  offsets. Pending previews mark omissions and prohibit approving incomplete
145
- previews or unsupported client tasks. Spoken responses target the original
147
+ cards or unsupported user actions. Spoken responses target the original
146
148
  thread, request and batch, with a second validation before canonical submission.
147
149
 
148
150
  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,25 @@
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
  ]
35
37
  },
36
- "runOutcome": { "requestId": "request-1", "status": "interaction_required", "failure": null }
38
+ "runOutcome": {
39
+ "requestId": "request-1",
40
+ "status": "interaction_required",
41
+ "failure": null
42
+ }
37
43
  }
38
44
  }
39
45
  }
@@ -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.15.0",
3
+ "contractVersion": "4.0.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.15.0",
3
+ "version": "4.0.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.15.0",
3
+ "contractVersion": "4.0.0",
4
4
  "manifest": "manifest/targets.v1.json",
5
5
  "schemas": {
6
6
  "frame": "schema/conversation-frame.v2.schema.json",