@mhome/messaging-protocol 0.14.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.
Files changed (61) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +71 -0
  3. package/fixtures/actor-link-claim-confirm.request.json +1 -0
  4. package/fixtures/actor-link-claim-confirm.response.json +1 -0
  5. package/fixtures/actor-link-claim-event.response.json +1 -0
  6. package/fixtures/actor-link-claim-status.request.json +1 -0
  7. package/fixtures/actor-link-claim-status.response.json +1 -0
  8. package/fixtures/actor-link-code-create.request.json +1 -0
  9. package/fixtures/actor-link-code-create.response.json +1 -0
  10. package/fixtures/actor-link-delete.request.json +1 -0
  11. package/fixtures/actor-link-delete.response.json +1 -0
  12. package/fixtures/actor-link-list.request.json +1 -0
  13. package/fixtures/actor-link-list.response.json +1 -0
  14. package/fixtures/invalid/mismatched-direction.json +5 -0
  15. package/fixtures/invalid/missing-required-extension.json +5 -0
  16. package/fixtures/invalid/unknown-request-field.json +5 -0
  17. package/fixtures/messaging-commands.conformance.json +20 -0
  18. package/fixtures/normalized-inbound.conformance.json +148 -0
  19. package/fixtures/normalized-inbound.shared-text.json +25 -0
  20. package/fixtures/provider-account-delete.request.json +9 -0
  21. package/fixtures/provider-account-delete.response.json +5 -0
  22. package/fixtures/provider-account-list.request.json +5 -0
  23. package/fixtures/provider-account-list.response.json +21 -0
  24. package/fixtures/provider-account-status.request.json +5 -0
  25. package/fixtures/provider-account-status.response.json +12 -0
  26. package/fixtures/provider-account-test.request.json +5 -0
  27. package/fixtures/provider-account-test.response.json +5 -0
  28. package/fixtures/provider-account-update.request.json +10 -0
  29. package/fixtures/provider-account-update.response.json +15 -0
  30. package/fixtures/provider-list.request.json +14 -0
  31. package/fixtures/provider-list.response.json +31 -0
  32. package/fixtures/route-delete.request.json +5 -0
  33. package/fixtures/route-delete.response.json +5 -0
  34. package/fixtures/route-list.request.json +5 -0
  35. package/fixtures/route-list.response.json +37 -0
  36. package/fixtures/route-update.request.json +12 -0
  37. package/fixtures/route-update.response.json +20 -0
  38. package/fixtures/setup-options.request.json +5 -0
  39. package/fixtures/setup-options.response.json +5 -0
  40. package/fixtures/setup-start.request.json +9 -0
  41. package/fixtures/setup-start.response.json +12 -0
  42. package/fixtures/setup-status.request.json +5 -0
  43. package/fixtures/setup-status.response.json +14 -0
  44. package/fixtures/shared-account-grant-create.request.json +5 -0
  45. package/fixtures/shared-account-grant-create.response.json +5 -0
  46. package/fixtures/shared-account-grant-delete.request.json +5 -0
  47. package/fixtures/shared-account-grant-delete.response.json +5 -0
  48. package/fixtures/shared-account-grant-list.request.json +5 -0
  49. package/fixtures/shared-account-grant-list.response.json +9 -0
  50. package/fixtures/surface-bind-code-create.request.json +1 -0
  51. package/fixtures/surface-bind-code-create.response.json +1 -0
  52. package/fixtures/surface-dismiss.request.json +1 -0
  53. package/fixtures/surface-dismiss.response.json +1 -0
  54. package/fixtures/surface-list.request.json +1 -0
  55. package/fixtures/surface-list.response.json +1 -0
  56. package/manifest/targets.v1.json +57 -0
  57. package/package.json +43 -0
  58. package/protocol.json +16 -0
  59. package/schema/messaging-commands.v1.schema.json +67 -0
  60. package/schema/messaging-frame.v3.schema.json +2534 -0
  61. package/schema/normalized-inbound.v4.schema.json +117 -0
@@ -0,0 +1,12 @@
1
+ {
2
+ "target": "/messaging/setup/start",
3
+ "direction": "response",
4
+ "body": {
5
+ "setup": {
6
+ "setupId": "setup-1",
7
+ "status": "action_required",
8
+ "expiresAtMs": 1893456000000,
9
+ "providerData": { "pairingCode": "ABCD" }
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/setup/status",
3
+ "direction": "request",
4
+ "body": { "provider": "telegram", "placement": "local", "setupId": "setup-1" }
5
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "target": "/messaging/setup/status",
3
+ "direction": "response",
4
+ "body": {
5
+ "setup": {
6
+ "setupId": "setup-1",
7
+ "status": "complete",
8
+ "providerData": {},
9
+ "accountId": "official-bot",
10
+ "routeId": "route-1",
11
+ "message": "Connected"
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/shared-account-grant/create",
3
+ "direction": "request",
4
+ "body": { "provider": "telegram", "placement": "local", "accountId": "123456" }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/shared-account-grant/create",
3
+ "direction": "response",
4
+ "body": { "success": true }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/shared-account-grant/delete",
3
+ "direction": "request",
4
+ "body": { "provider": "telegram", "placement": "local", "accountId": "123456" }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/shared-account-grant/delete",
3
+ "direction": "response",
4
+ "body": { "success": true }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/shared-account-grant/list",
3
+ "direction": "request",
4
+ "body": { "provider": "telegram", "placement": "local", "accountId": "123456" }
5
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "target": "/messaging/shared-account-grant/list",
3
+ "direction": "response",
4
+ "body": {
5
+ "grants": [
6
+ { "provider": "telegram", "placement": "local", "accountId": "123456", "tenantId": "tenant-1", "scopeId": "scope-1", "grantedByUserId": "user-1", "createdAtMs": 1787961600000, "updatedAtMs": 1787961600000 }
7
+ ]
8
+ }
9
+ }
@@ -0,0 +1 @@
1
+ {"target":"/messaging/surface/bind-code/create","direction":"request","body":{"provider":"feishu","placement":"local","surfaceId":"cs1:mg:feishu:Y2xpX2E:Y2hhdF9h","scopeId":"scope_a"}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/surface/bind-code/create","direction":"response","body":{"challenge":{"code":"M7K9Q2","command":"/bind M7K9Q2","expiresAtMs":1720000300000}}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/surface/dismiss","direction":"request","body":{"provider":"feishu","placement":"local","surfaceId":"cs1:mg:feishu:Y2xpX2E:Y2hhdF9h"}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/surface/dismiss","direction":"response","body":{"success":true}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/surface/list","direction":"request","body":{"provider":"feishu","placement":"local","state":"pending"}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/surface/list","direction":"response","body":{"surfaces":[{"provider":"feishu","placement":"local","accountId":"cli_a","surfaceId":"cs1:mg:feishu:Y2xpX2E:Y2hhdF9h","displayName":"Project room","state":"pending","firstSeenAtMs":1720000000000,"lastSeenAtMs":1720000001000}]}}
@@ -0,0 +1,57 @@
1
+ {
2
+ "manifest": "mhome.messaging.targets.v1",
3
+ "contractVersion": "0.14.0",
4
+ "requestTargets": [
5
+ "/messaging/provider/list",
6
+ "/messaging/provider-account/list",
7
+ "/messaging/provider-account/update",
8
+ "/messaging/provider-account/delete",
9
+ "/messaging/provider-account/test",
10
+ "/messaging/provider-account/status",
11
+ "/messaging/shared-account-grant/create",
12
+ "/messaging/shared-account-grant/delete",
13
+ "/messaging/shared-account-grant/list",
14
+ "/messaging/route/list",
15
+ "/messaging/route/update",
16
+ "/messaging/route/delete",
17
+ "/messaging/setup/options",
18
+ "/messaging/setup/start",
19
+ "/messaging/setup/status",
20
+ "/messaging/surface/list",
21
+ "/messaging/surface/dismiss",
22
+ "/messaging/surface/bind-code/create",
23
+ "/messaging/actor/link-code/create",
24
+ "/messaging/actor/link-claim/status",
25
+ "/messaging/actor/link-claim/confirm",
26
+ "/messaging/actor/link/list",
27
+ "/messaging/actor/link/delete"
28
+ ],
29
+ "responseTargets": [
30
+ "/messaging/provider/list",
31
+ "/messaging/provider-account/list",
32
+ "/messaging/provider-account/update",
33
+ "/messaging/provider-account/delete",
34
+ "/messaging/provider-account/test",
35
+ "/messaging/provider-account/status",
36
+ "/messaging/shared-account-grant/create",
37
+ "/messaging/shared-account-grant/delete",
38
+ "/messaging/shared-account-grant/list",
39
+ "/messaging/route/list",
40
+ "/messaging/route/update",
41
+ "/messaging/route/delete",
42
+ "/messaging/setup/options",
43
+ "/messaging/setup/start",
44
+ "/messaging/setup/status",
45
+ "/messaging/surface/list",
46
+ "/messaging/surface/dismiss",
47
+ "/messaging/surface/bind-code/create",
48
+ "/messaging/actor/link-code/create",
49
+ "/messaging/actor/link-claim/status",
50
+ "/messaging/actor/link-claim/confirm",
51
+ "/messaging/actor/link/list",
52
+ "/messaging/actor/link/delete"
53
+ ],
54
+ "eventTargets": [
55
+ "/messaging/actor/link-claim/event"
56
+ ]
57
+ }
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@mhome/messaging-protocol",
3
+ "version": "0.14.0",
4
+ "description": "Build-time protocol artifacts for mhome.messaging",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/mhome-ai/foundation.git",
9
+ "directory": "crates/messaging-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,16 @@
1
+ {
2
+ "protocol": "mhome.messaging",
3
+ "contractVersion": "0.14.0",
4
+ "manifest": "manifest/targets.v1.json",
5
+ "schemas": {
6
+ "frame": "schema/messaging-frame.v3.schema.json",
7
+ "normalizedInbound": "schema/normalized-inbound.v4.schema.json",
8
+ "messagingCommands": "schema/messaging-commands.v1.schema.json"
9
+ },
10
+ "fixtures": {
11
+ "valid": "fixtures",
12
+ "invalid": "fixtures/invalid",
13
+ "normalizedInbound": "fixtures/normalized-inbound.conformance.json",
14
+ "messagingCommands": "fixtures/messaging-commands.conformance.json"
15
+ }
16
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:mhome:messaging-api: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
+ }