@mhome/core-protocol 1.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 mHome.ai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # mhome-core-api
2
+
3
+ Canonical internal wire protocol for MeowCore, host services, Nodes, and
4
+ provider runtimes. Public `/app/*` contracts belong to
5
+ `mhome-app-facade-api`; this crate owns internal MWS, authentication, LLM,
6
+ Messaging normalization, Node runtime, and Storage contracts.
7
+
8
+ Storage separates backing-filesystem capacity from Storage-owned logical
9
+ usage. Namespace is an internal protocol term; user-facing clients present it
10
+ as a Folder.
@@ -0,0 +1,20 @@
1
+ {
2
+ "manifest": "mhome.node.runtime.v1",
3
+ "version": "v1",
4
+ "runtimeEnvelope": {
5
+ "requestFields": ["version", "payload"],
6
+ "responseFields": ["version", "data"]
7
+ },
8
+ "settings": {
9
+ "changedTarget": "/node/settings/changed",
10
+ "routes": ["settings/status", "settings/update", "settings/revert", "settings/retry"]
11
+ },
12
+ "llm": {
13
+ "runtimeTargetPrefix": "/llm/app/",
14
+ "completeTarget": "/llm/complete",
15
+ "modelImportUploadPathPrefix": "/llm/model/import/upload"
16
+ },
17
+ "audioBridge": {
18
+ "runtimeTargetPrefix": "/audiobridge/app/"
19
+ }
20
+ }
@@ -0,0 +1,109 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mhome.dev/contracts/node-service-protocol-v1.json",
4
+ "title": "Node Service Protocol V1",
5
+ "$defs": {
6
+ "emptyRequest": {
7
+ "type": "object",
8
+ "properties": {},
9
+ "additionalProperties": false
10
+ },
11
+ "describe": {
12
+ "type": "object",
13
+ "required": [
14
+ "schemaVersion",
15
+ "nodeType",
16
+ "serviceId",
17
+ "serviceVersion",
18
+ "instancePolicy",
19
+ "routes",
20
+ "capabilities",
21
+ "details"
22
+ ],
23
+ "properties": {
24
+ "schemaVersion": { "const": "mhome.node.describe.v1" },
25
+ "nodeType": { "type": "string", "minLength": 1 },
26
+ "serviceId": { "type": "string", "minLength": 1 },
27
+ "serviceVersion": { "type": "string", "minLength": 1 },
28
+ "instancePolicy": {
29
+ "enum": ["multiple", "singleton", "shared"]
30
+ },
31
+ "routes": {
32
+ "type": "array",
33
+ "items": { "type": "string", "pattern": "^/" },
34
+ "uniqueItems": true
35
+ },
36
+ "capabilities": {
37
+ "type": "array",
38
+ "items": { "type": "string", "minLength": 1 },
39
+ "uniqueItems": true
40
+ },
41
+ "details": { "type": "object" }
42
+ },
43
+ "additionalProperties": true
44
+ },
45
+ "readinessReason": {
46
+ "type": "object",
47
+ "required": ["code", "message", "retryable"],
48
+ "properties": {
49
+ "code": { "type": "string", "minLength": 1 },
50
+ "message": { "type": "string", "minLength": 1 },
51
+ "retryable": { "type": "boolean" }
52
+ },
53
+ "additionalProperties": true
54
+ },
55
+ "readiness": {
56
+ "type": "object",
57
+ "required": [
58
+ "schemaVersion",
59
+ "nodeType",
60
+ "serviceId",
61
+ "serviceVersion",
62
+ "processGeneration",
63
+ "state",
64
+ "ready",
65
+ "revision",
66
+ "updatedAtMs",
67
+ "reason",
68
+ "details"
69
+ ],
70
+ "properties": {
71
+ "schemaVersion": { "const": "mhome.node.readiness.v1" },
72
+ "nodeType": { "type": "string", "minLength": 1 },
73
+ "serviceId": { "type": "string", "minLength": 1 },
74
+ "serviceVersion": { "type": "string", "minLength": 1 },
75
+ "processGeneration": { "type": "string", "minLength": 1 },
76
+ "state": {
77
+ "enum": [
78
+ "starting",
79
+ "ready",
80
+ "degraded",
81
+ "failed",
82
+ "stopping",
83
+ "stopped"
84
+ ]
85
+ },
86
+ "ready": { "type": "boolean" },
87
+ "revision": { "type": "integer", "minimum": 0 },
88
+ "updatedAtMs": { "type": "integer" },
89
+ "reason": {
90
+ "oneOf": [
91
+ { "type": "null" },
92
+ { "$ref": "#/$defs/readinessReason" }
93
+ ]
94
+ },
95
+ "details": { "type": "object" }
96
+ },
97
+ "additionalProperties": true
98
+ }
99
+ },
100
+ "type": "object",
101
+ "required": ["describeRequest", "readinessRequest", "describe", "readiness"],
102
+ "properties": {
103
+ "describeRequest": { "$ref": "#/$defs/emptyRequest" },
104
+ "readinessRequest": { "$ref": "#/$defs/emptyRequest" },
105
+ "describe": { "$ref": "#/$defs/describe" },
106
+ "readiness": { "$ref": "#/$defs/readiness" }
107
+ },
108
+ "additionalProperties": false
109
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "parseCases": [
4
+ { "name": "info", "input": "/info", "result": { "kind": "command", "command": "info" } },
5
+ { "name": "case-insensitive-help", "input": " /HELP ", "result": { "kind": "command", "command": "help" } },
6
+ { "name": "new-rotates", "input": "/new", "result": { "kind": "command", "command": "rotate" } },
7
+ { "name": "clear-rotates", "input": "/clear", "result": { "kind": "command", "command": "rotate" } },
8
+ { "name": "spaced-switch", "input": "/switch 3", "result": { "kind": "command", "command": "switch", "selection": 3 } },
9
+ { "name": "compact-switch", "input": "/SWITCH2", "result": { "kind": "command", "command": "switch", "selection": 2 } },
10
+ { "name": "missing-switch-selection", "input": "/switch", "result": { "kind": "invalid_switch" } },
11
+ { "name": "zero-switch-selection", "input": "/switch 0", "result": { "kind": "invalid_switch" } },
12
+ { "name": "negative-switch-selection", "input": "/switch -1", "result": { "kind": "invalid_switch" } },
13
+ { "name": "unknown-text", "input": "hello", "result": { "kind": "not_command" } },
14
+ { "name": "unknown-command", "input": "/usage", "result": { "kind": "not_command" } }
15
+ ],
16
+ "orderingCases": [
17
+ { "name": "stable-scope-id-order", "scopeIds": ["scope-z", "scope-a", "scope-m"], "expected": ["scope-a", "scope-m", "scope-z"] },
18
+ { "name": "lexical-order-is-case-sensitive", "scopeIds": ["scope-b", "Scope-a"], "expected": ["Scope-a", "scope-b"] }
19
+ ]
20
+ }
@@ -0,0 +1,148 @@
1
+ {
2
+ "valid": [
3
+ {
4
+ "name": "personal_text",
5
+ "value": {
6
+ "schemaVersion": 4,
7
+ "eventId": "event-personal-text",
8
+ "address": { "provider": "telegram", "accountId": "bot-1", "conversationId": "chat-1", "audience": "personal" },
9
+ "actor": { "provider": "telegram", "accountId": "bot-1", "externalUserId": "user-1", "displayName": "User One" },
10
+ "content": { "type": "message", "providerMessageId": "message-1", "attention": "unknown", "parts": [{ "type": "text", "text": "hello" }] },
11
+ "occurredAtMs": 1
12
+ }
13
+ },
14
+ {
15
+ "name": "shared_text_with_lane",
16
+ "value": {
17
+ "schemaVersion": 4,
18
+ "eventId": "event-shared-text",
19
+ "address": { "provider": "feishu", "accountId": "app-1", "conversationId": "group-1", "laneId": "thread-1", "audience": "shared" },
20
+ "actor": { "provider": "feishu", "accountId": "app-1", "externalUserId": "open-id-1" },
21
+ "content": { "type": "message", "attention": "addressed", "parts": [{ "type": "text", "text": "group hello" }] },
22
+ "conversationDisplayName": "Project room"
23
+ }
24
+ },
25
+ {
26
+ "name": "audio_with_transcript",
27
+ "value": {
28
+ "schemaVersion": 4,
29
+ "eventId": "event-audio",
30
+ "address": { "provider": "telegram", "accountId": "bot-1", "conversationId": "chat-1", "audience": "personal" },
31
+ "actor": { "provider": "telegram", "accountId": "bot-1", "externalUserId": "user-1" },
32
+ "content": {
33
+ "type": "message",
34
+ "providerMessageId": "message-2",
35
+ "attention": "unknown",
36
+ "parts": [{ "type": "media", "reference": { "handle": "file-1", "kind": "audio", "mimeType": "audio/ogg", "durationMs": 1200, "transcript": "hello" } }]
37
+ }
38
+ }
39
+ },
40
+ {
41
+ "name": "action_selected",
42
+ "value": {
43
+ "schemaVersion": 4,
44
+ "eventId": "event-action-selected",
45
+ "address": { "provider": "feishu", "accountId": "app-1", "conversationId": "chat-1", "audience": "personal" },
46
+ "actor": { "provider": "feishu", "accountId": "app-1", "externalUserId": "open-id-1" },
47
+ "content": { "type": "action_selected", "token": "route-1" }
48
+ }
49
+ }
50
+ ],
51
+ "invalid": [
52
+ {
53
+ "name": "provider_starts_with_digit",
54
+ "value": {
55
+ "schemaVersion": 4,
56
+ "eventId": "event",
57
+ "address": { "provider": "1telegram", "accountId": "bot", "conversationId": "chat", "audience": "personal" },
58
+ "actor": { "provider": "1telegram", "accountId": "bot", "externalUserId": "user" },
59
+ "content": { "type": "message", "attention": "unknown", "parts": [{ "type": "text", "text": "hello" }] }
60
+ }
61
+ },
62
+ {
63
+ "name": "negative_occurrence_time",
64
+ "value": {
65
+ "schemaVersion": 4,
66
+ "eventId": "event",
67
+ "address": { "provider": "telegram", "accountId": "bot", "conversationId": "chat", "audience": "personal" },
68
+ "actor": { "provider": "telegram", "accountId": "bot", "externalUserId": "user" },
69
+ "content": { "type": "message", "attention": "unknown", "parts": [{ "type": "text", "text": "hello" }] },
70
+ "occurredAtMs": -1
71
+ }
72
+ },
73
+ {
74
+ "name": "actor_account_mismatch",
75
+ "value": {
76
+ "schemaVersion": 4,
77
+ "eventId": "event",
78
+ "address": { "provider": "telegram", "accountId": "bot-a", "conversationId": "chat", "audience": "personal" },
79
+ "actor": { "provider": "telegram", "accountId": "bot-b", "externalUserId": "user" },
80
+ "content": { "type": "message", "attention": "unknown", "parts": [{ "type": "text", "text": "hello" }] }
81
+ }
82
+ },
83
+ {
84
+ "name": "empty_message",
85
+ "value": {
86
+ "schemaVersion": 4,
87
+ "eventId": "event",
88
+ "address": { "provider": "telegram", "accountId": "bot", "conversationId": "chat", "audience": "personal" },
89
+ "actor": { "provider": "telegram", "accountId": "bot", "externalUserId": "user" },
90
+ "content": { "type": "message", "attention": "unknown", "parts": [] }
91
+ }
92
+ },
93
+ {
94
+ "name": "incomplete_media_dimensions",
95
+ "value": {
96
+ "schemaVersion": 4,
97
+ "eventId": "event",
98
+ "address": { "provider": "telegram", "accountId": "bot", "conversationId": "chat", "audience": "personal" },
99
+ "actor": { "provider": "telegram", "accountId": "bot", "externalUserId": "user" },
100
+ "content": { "type": "message", "attention": "unknown", "parts": [{ "type": "media", "reference": { "handle": "file", "kind": "image", "widthPx": 100 } }] }
101
+ }
102
+ },
103
+ {
104
+ "name": "unknown_schema_version",
105
+ "value": {
106
+ "schemaVersion": 2,
107
+ "eventId": "event",
108
+ "address": { "provider": "telegram", "accountId": "bot", "conversationId": "chat", "audience": "personal" },
109
+ "actor": { "provider": "telegram", "accountId": "bot", "externalUserId": "user" },
110
+ "content": { "type": "message", "attention": "unknown", "parts": [{ "type": "text", "text": "hello" }] }
111
+ }
112
+ },
113
+ {
114
+ "name": "missing_message_attention",
115
+ "value": {
116
+ "schemaVersion": 4,
117
+ "eventId": "event",
118
+ "address": { "provider": "telegram", "accountId": "bot", "conversationId": "chat", "audience": "shared" },
119
+ "actor": { "provider": "telegram", "accountId": "bot", "externalUserId": "user" },
120
+ "content": { "type": "message", "parts": [{ "type": "text", "text": "hello" }] }
121
+ }
122
+ },
123
+ {
124
+ "name": "too_many_message_parts",
125
+ "value": {
126
+ "schemaVersion": 4,
127
+ "eventId": "event",
128
+ "address": { "provider": "telegram", "accountId": "bot", "conversationId": "chat", "audience": "personal" },
129
+ "actor": { "provider": "telegram", "accountId": "bot", "externalUserId": "user" },
130
+ "content": {
131
+ "type": "message",
132
+ "attention": "unknown",
133
+ "parts": [
134
+ { "type": "text", "text": "1" }, { "type": "text", "text": "2" },
135
+ { "type": "text", "text": "3" }, { "type": "text", "text": "4" },
136
+ { "type": "text", "text": "5" }, { "type": "text", "text": "6" },
137
+ { "type": "text", "text": "7" }, { "type": "text", "text": "8" },
138
+ { "type": "text", "text": "9" }, { "type": "text", "text": "10" },
139
+ { "type": "text", "text": "11" }, { "type": "text", "text": "12" },
140
+ { "type": "text", "text": "13" }, { "type": "text", "text": "14" },
141
+ { "type": "text", "text": "15" }, { "type": "text", "text": "16" },
142
+ { "type": "text", "text": "17" }
143
+ ]
144
+ }
145
+ }
146
+ }
147
+ ]
148
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "manifest": "mhome.core.v1",
3
+ "contractVersion": "1.1.1",
4
+ "protocols": {
5
+ "llm": {
6
+ "completeTarget": "/llm/complete"
7
+ },
8
+ "node": {
9
+ "settingsChangedTarget": "/node/settings/changed",
10
+ "statusContract": "mhome.node.status.v1",
11
+ "runtimeVersion": "v1"
12
+ },
13
+ "messaging": {
14
+ "normalizedInboundSchema": "schema/normalized-inbound.v4.schema.json",
15
+ "commandsSchema": "schema/messaging-commands.v1.schema.json"
16
+ },
17
+ "storage": {
18
+ "version": "storage.v2"
19
+ }
20
+ }
21
+ }
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@mhome/core-protocol",
3
+ "version": "1.1.1",
4
+ "description": "Build-time protocol artifacts for mhome.core",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/mhome-ai/foundation.git",
9
+ "directory": "crates/core-api"
10
+ },
11
+ "homepage": "https://github.com/mhome-ai/foundation#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/mhome-ai/foundation/issues"
14
+ },
15
+ "keywords": [
16
+ "mhome",
17
+ "protocol",
18
+ "json-schema",
19
+ "fixtures"
20
+ ],
21
+ "private": false,
22
+ "files": [
23
+ "protocol.json",
24
+ "manifest",
25
+ "contract",
26
+ "schema",
27
+ "fixtures",
28
+ "README.md",
29
+ "LICENSE"
30
+ ],
31
+ "exports": {
32
+ "./package.json": "./package.json",
33
+ "./protocol.json": "./protocol.json",
34
+ "./manifest/*": "./manifest/*",
35
+ "./contract/*": "./contract/*",
36
+ "./schema/*": "./schema/*",
37
+ "./fixtures/*": "./fixtures/*"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public",
41
+ "provenance": true
42
+ }
43
+ }
package/protocol.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "protocol": "mhome.core",
3
+ "contractVersion": "1.1.1",
4
+ "manifest": "manifest/core.v1.json",
5
+ "schemas": {
6
+ "normalizedInbound": "schema/normalized-inbound.v4.schema.json",
7
+ "messagingCommands": "schema/messaging-commands.v1.schema.json"
8
+ },
9
+ "fixtures": {
10
+ "normalizedInbound": "fixtures/normalized-inbound.conformance.json",
11
+ "messagingCommands": "fixtures/messaging-commands.conformance.json"
12
+ }
13
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:mhome:core-api:messaging:commands:v1",
4
+ "title": "mHome messaging command conformance corpus v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "parseCases", "orderingCases"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "parseCases": {
11
+ "type": "array",
12
+ "minItems": 1,
13
+ "items": {
14
+ "type": "object",
15
+ "additionalProperties": false,
16
+ "required": ["name", "input", "result"],
17
+ "properties": {
18
+ "name": { "type": "string", "minLength": 1 },
19
+ "input": { "type": "string" },
20
+ "result": {
21
+ "oneOf": [
22
+ {
23
+ "type": "object",
24
+ "additionalProperties": false,
25
+ "required": ["kind"],
26
+ "properties": { "kind": { "enum": ["not_command", "invalid_switch"] } }
27
+ },
28
+ {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "required": ["kind", "command"],
32
+ "properties": {
33
+ "kind": { "const": "command" },
34
+ "command": { "enum": ["info", "help", "rotate"] }
35
+ }
36
+ },
37
+ {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "required": ["kind", "command", "selection"],
41
+ "properties": {
42
+ "kind": { "const": "command" },
43
+ "command": { "const": "switch" },
44
+ "selection": { "type": "integer", "minimum": 1 }
45
+ }
46
+ }
47
+ ]
48
+ }
49
+ }
50
+ }
51
+ },
52
+ "orderingCases": {
53
+ "type": "array",
54
+ "minItems": 1,
55
+ "items": {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": ["name", "scopeIds", "expected"],
59
+ "properties": {
60
+ "name": { "type": "string", "minLength": 1 },
61
+ "scopeIds": { "type": "array", "items": { "type": "string", "minLength": 1 } },
62
+ "expected": { "type": "array", "items": { "type": "string", "minLength": 1 } }
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,117 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:mhome:core-api:messaging:normalized-inbound:v4",
4
+ "title": "mHome normalized messaging inbound v4",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "eventId", "address", "actor", "content"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 4 },
10
+ "eventId": { "$ref": "#/$defs/id" },
11
+ "address": { "$ref": "#/$defs/address" },
12
+ "actor": { "$ref": "#/$defs/actor" },
13
+ "content": { "$ref": "#/$defs/content" },
14
+ "conversationDisplayName": { "$ref": "#/$defs/id" },
15
+ "occurredAtMs": { "type": "integer", "minimum": 0 }
16
+ },
17
+ "$defs": {
18
+ "id": { "type": "string", "minLength": 1, "pattern": "^\\S(?:.*\\S)?$" },
19
+ "text": { "type": "string", "minLength": 1 },
20
+ "providerId": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
21
+ "address": {
22
+ "type": "object",
23
+ "additionalProperties": false,
24
+ "required": ["provider", "accountId", "conversationId", "audience"],
25
+ "properties": {
26
+ "provider": { "$ref": "#/$defs/providerId" },
27
+ "accountId": { "$ref": "#/$defs/id" },
28
+ "conversationId": { "$ref": "#/$defs/id" },
29
+ "laneId": { "$ref": "#/$defs/id" },
30
+ "audience": { "enum": ["personal", "shared"] }
31
+ }
32
+ },
33
+ "actor": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["provider", "accountId", "externalUserId"],
37
+ "properties": {
38
+ "provider": { "$ref": "#/$defs/providerId" },
39
+ "accountId": { "$ref": "#/$defs/id" },
40
+ "externalUserId": { "$ref": "#/$defs/id" },
41
+ "displayName": { "$ref": "#/$defs/id" }
42
+ }
43
+ },
44
+ "media": {
45
+ "type": "object",
46
+ "additionalProperties": false,
47
+ "required": ["handle", "kind"],
48
+ "properties": {
49
+ "handle": { "$ref": "#/$defs/id" },
50
+ "kind": { "enum": ["image", "audio", "video", "file"] },
51
+ "mimeType": { "$ref": "#/$defs/id" },
52
+ "sizeBytes": { "type": "integer", "minimum": 1 },
53
+ "fileName": { "$ref": "#/$defs/id" },
54
+ "durationMs": { "type": "integer", "minimum": 1 },
55
+ "widthPx": { "type": "integer", "minimum": 1 },
56
+ "heightPx": { "type": "integer", "minimum": 1 },
57
+ "caption": { "$ref": "#/$defs/id" },
58
+ "transcript": { "$ref": "#/$defs/id" }
59
+ },
60
+ "dependentRequired": {
61
+ "widthPx": ["heightPx"],
62
+ "heightPx": ["widthPx"]
63
+ }
64
+ },
65
+ "part": {
66
+ "oneOf": [
67
+ {
68
+ "type": "object",
69
+ "additionalProperties": false,
70
+ "required": ["type", "text"],
71
+ "properties": {
72
+ "type": { "const": "text" },
73
+ "text": { "$ref": "#/$defs/text" }
74
+ }
75
+ },
76
+ {
77
+ "type": "object",
78
+ "additionalProperties": false,
79
+ "required": ["type", "reference"],
80
+ "properties": {
81
+ "type": { "const": "media" },
82
+ "reference": { "$ref": "#/$defs/media" }
83
+ }
84
+ }
85
+ ]
86
+ },
87
+ "content": {
88
+ "oneOf": [
89
+ {
90
+ "type": "object",
91
+ "additionalProperties": false,
92
+ "required": ["type", "attention", "parts"],
93
+ "properties": {
94
+ "type": { "const": "message" },
95
+ "providerMessageId": { "$ref": "#/$defs/id" },
96
+ "attention": { "enum": ["addressed", "unaddressed", "unknown"] },
97
+ "parts": {
98
+ "type": "array",
99
+ "minItems": 1,
100
+ "maxItems": 16,
101
+ "items": { "$ref": "#/$defs/part" }
102
+ }
103
+ }
104
+ },
105
+ {
106
+ "type": "object",
107
+ "additionalProperties": false,
108
+ "required": ["type", "token"],
109
+ "properties": {
110
+ "type": { "const": "action_selected" },
111
+ "token": { "$ref": "#/$defs/id" }
112
+ }
113
+ }
114
+ ]
115
+ }
116
+ }
117
+ }