@mhome/artifact-protocol 1.1.1 → 1.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/README.md CHANGED
@@ -6,7 +6,10 @@ The crate is the source of truth for the `meow-artifact://v1/` URI format and it
6
6
  immutable image, audio, video, and file metadata. The published schema and conformance
7
7
  fixtures are intended for non-Rust runtimes.
8
8
 
9
- The crate also defines the transport-neutral `/artifact/resolve` request and response.
9
+ The crate also defines the transport-neutral `/artifact/resolve`, `/artifact/put`, and
10
+ `/artifact/upload/prepare` request and response contracts. The upload preparation
11
+ contract keeps large artifact bytes on an authenticated HTTP data plane instead of
12
+ embedding them in a control-plane message.
10
13
  Delivery is an explicit `DATA_URL` or `SIGNED_URL` union; a signed URL may point to a
11
14
  cloud object store or an authenticated local streaming endpoint.
12
15
 
@@ -0,0 +1,48 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "valid": [
4
+ {
5
+ "name": "audio-upload-request",
6
+ "value": {
7
+ "kind": "AUDIO",
8
+ "mimeType": "audio/ogg",
9
+ "sizeBytes": 10800000,
10
+ "sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
11
+ "durationMillis": 3600000
12
+ }
13
+ },
14
+ {
15
+ "name": "upload-response",
16
+ "value": {
17
+ "uploadId": "upload-1",
18
+ "url": "http://127.0.0.1:3210/artifact/v1/upload/signed-grant",
19
+ "headers": {
20
+ "content-type": "audio/ogg",
21
+ "content-length": "10800000",
22
+ "x-meow-content-sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
23
+ },
24
+ "expiresAtUnixMs": 1700000000000
25
+ }
26
+ }
27
+ ],
28
+ "invalid": [
29
+ {
30
+ "name": "uppercase-hash",
31
+ "value": {
32
+ "kind": "AUDIO",
33
+ "mimeType": "audio/ogg",
34
+ "sizeBytes": 42,
35
+ "sha256": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
36
+ }
37
+ },
38
+ {
39
+ "name": "non-http-upload-url",
40
+ "value": {
41
+ "uploadId": "upload-1",
42
+ "url": "file:///tmp/upload",
43
+ "headers": {},
44
+ "expiresAtUnixMs": 1700000000000
45
+ }
46
+ }
47
+ ]
48
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.artifact.v1",
3
- "contractVersion": "1.1.1",
3
+ "contractVersion": "1.2.0",
4
4
  "uriPrefix": "meow-artifact://v1/",
5
5
  "kinds": ["image", "audio", "video", "file"],
6
6
  "resolve": {
@@ -12,5 +12,10 @@
12
12
  "target": "/artifact/put",
13
13
  "schema": "schema/artifact-put.v1.schema.json",
14
14
  "schemaVersion": 1
15
+ },
16
+ "uploadPrepare": {
17
+ "target": "/artifact/upload/prepare",
18
+ "schema": "schema/artifact-upload.v1.schema.json",
19
+ "schemaVersion": 1
15
20
  }
16
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mhome/artifact-protocol",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "Build-time protocol artifacts for mhome.artifact",
5
5
  "license": "MIT",
6
6
  "repository": {
package/protocol.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "protocol": "mhome.artifact",
3
- "contractVersion": "1.1.1",
3
+ "contractVersion": "1.2.0",
4
4
  "manifest": "manifest/artifact.v1.json",
5
5
  "schemas": {
6
6
  "artifactMetadata": "schema/artifact-metadata.v1.schema.json",
7
7
  "artifactResolve": "schema/artifact-resolve.v1.schema.json",
8
- "artifactPut": "schema/artifact-put.v1.schema.json"
8
+ "artifactPut": "schema/artifact-put.v1.schema.json",
9
+ "artifactUpload": "schema/artifact-upload.v1.schema.json"
9
10
  },
10
11
  "fixtures": {
11
12
  "artifactReference": "fixtures/artifact-reference.conformance.json",
12
13
  "artifactResolve": "fixtures/artifact-resolve.conformance.json",
13
- "artifactPut": "fixtures/artifact-put.conformance.json"
14
+ "artifactPut": "fixtures/artifact-put.conformance.json",
15
+ "artifactUpload": "fixtures/artifact-upload.conformance.json"
14
16
  }
15
17
  }
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mhome.ai/schema/artifact-upload.v1.schema.json",
4
+ "title": "mHome Artifact Upload v1",
5
+ "oneOf": [
6
+ { "$ref": "#/$defs/request" },
7
+ { "$ref": "#/$defs/response" }
8
+ ],
9
+ "$defs": {
10
+ "request": {
11
+ "type": "object",
12
+ "additionalProperties": false,
13
+ "required": ["kind", "mimeType", "sizeBytes", "sha256"],
14
+ "properties": {
15
+ "kind": { "enum": ["IMAGE", "AUDIO", "VIDEO", "FILE"] },
16
+ "mimeType": { "type": "string", "minLength": 3, "maxLength": 255 },
17
+ "sizeBytes": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
18
+ "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
19
+ "durationMillis": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }
20
+ }
21
+ },
22
+ "response": {
23
+ "type": "object",
24
+ "additionalProperties": false,
25
+ "required": ["uploadId", "url", "headers", "expiresAtUnixMs"],
26
+ "properties": {
27
+ "uploadId": { "type": "string", "minLength": 1 },
28
+ "url": { "type": "string", "pattern": "^https?://" },
29
+ "headers": {
30
+ "type": "object",
31
+ "additionalProperties": { "type": "string" }
32
+ },
33
+ "expiresAtUnixMs": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }
34
+ }
35
+ }
36
+ }
37
+ }