@mhome/plugin-protocol 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 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,24 @@
1
+ # mhome-plugin-api
2
+
3
+ Typed, transport-neutral wire contracts for controlling mHome Plugins.
4
+
5
+ The crate owns the common control/runtime envelopes, the reusable settings protocol, and the
6
+ public request contracts for built-in Plugin types. It deliberately contains no transport,
7
+ dispatch, authorization, persistence, runtime lifecycle, or Plugin implementation logic.
8
+
9
+ The LLM v1 contract also owns the runtime target prefix, resumable custom-model import control
10
+ routes, snapshots, upload grant, chunk acknowledgement, and LAN HTTP upload path prefix.
11
+ File-system paths are intentionally absent from the Node-facing contract: a client-side service
12
+ reads the local artifact and transfers only its bytes and public metadata.
13
+
14
+ Cargo package versions and wire contract versions are independent. Each built-in Plugin contract
15
+ declares its own wire version so that one Plugin can evolve without forcing unrelated Plugins to
16
+ change version.
17
+
18
+ `contract/node-protocol-v1.json` is the language-neutral v1 manifest used by Rust and browser
19
+ adapters. Consumers vendor the exact manifest as a pinned build dependency and verify their
20
+ generated constants or serialized wire shapes in tests. During pre-release development, v1 is
21
+ replaced in lockstep across all consumers; after the protocol is released, incompatible changes
22
+ require a new manifest version. The backend-status entries describe the common transport envelope
23
+ consumed alongside Plugin control, but ownership of its Rust runtime model remains in Baycat
24
+ `service-api`.
@@ -0,0 +1,72 @@
1
+ {
2
+ "manifest": "mhome.node.protocol.v1",
3
+ "pluginApi": {
4
+ "version": "v1",
5
+ "controlTargetPrefix": "/app/plugin/control",
6
+ "controlRequestFields": ["pluginId", "version", "payload"],
7
+ "controlResponseFields": ["pluginId", "pluginType", "version", "data"],
8
+ "settingsChangedTarget": "/plugin/settings/changed",
9
+ "settingsChangedEventFields": [
10
+ "version",
11
+ "pluginId",
12
+ "pluginType",
13
+ "eventSeq",
14
+ "section",
15
+ "revision"
16
+ ]
17
+ },
18
+ "llm": {
19
+ "version": "v1",
20
+ "runtimeTargetPrefix": "/llm/app/",
21
+ "routes": {
22
+ "modelImportStart": "model/import/start",
23
+ "modelImportStatus": "model/import/status",
24
+ "modelImportFinalize": "model/import/finalize",
25
+ "modelImportCancel": "model/import/cancel"
26
+ },
27
+ "modelImportUploadPathPrefix": "/llm/model/import/upload",
28
+ "modelImportUploadHeaders": {
29
+ "authorization": "authorization",
30
+ "offset": "x-upload-offset",
31
+ "chunkSha256": "x-chunk-sha256"
32
+ },
33
+ "modelImportStartRequestFields": [
34
+ "displayName",
35
+ "fileName",
36
+ "artifactSha256",
37
+ "sizeBytes",
38
+ "idempotencyKey"
39
+ ],
40
+ "modelImportOperationRequestFields": ["operationId"],
41
+ "modelImportChunkResponseFields": [
42
+ "ok",
43
+ "operationId",
44
+ "receivedBytes",
45
+ "reason",
46
+ "detail"
47
+ ]
48
+ },
49
+ "backendStatus": {
50
+ "nodeContract": "baycat.node.status.v1",
51
+ "contract": "baycat.backend.status.v1",
52
+ "queryTarget": "/backend/status",
53
+ "changedTarget": "/backend/status/changed",
54
+ "resourceEnvelopeFields": [
55
+ "contract",
56
+ "scopeId",
57
+ "hubGeneration",
58
+ "hubRevision",
59
+ "observedAtMs",
60
+ "resource",
61
+ "deleted",
62
+ "snapshot"
63
+ ],
64
+ "resourceTypes": [
65
+ "nodeInstance",
66
+ "nodeRuntime",
67
+ "managedService",
68
+ "hubConnection",
69
+ "scopeConnection"
70
+ ]
71
+ }
72
+ }
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@mhome/plugin-protocol",
3
+ "version": "0.2.0",
4
+ "description": "Build-time protocol artifacts for mhome.plugin",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/mhome-ai/foundation.git",
9
+ "directory": "crates/plugin-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,7 @@
1
+ {
2
+ "protocol": "mhome.plugin",
3
+ "contractVersion": "0.2.0",
4
+ "manifest": "contract/node-protocol-v1.json",
5
+ "schemas": {},
6
+ "fixtures": {}
7
+ }