@mhome/artifact-protocol 1.1.1 → 1.3.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,9 +6,14 @@ 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
 
13
16
  TTL, storage placement, filesystem paths, signed URLs, and cloud object keys are
14
17
  runtime concerns and are deliberately not encoded into an artifact reference.
18
+
19
+ Capability media values (`Image`, `Audio`) use `MediaReference`: exactly `{ "uri": "meow-artifact://v1/..." }`. The reference has no URL, inline bytes, MIME or creation timestamp fields. Parse and check kind and tenant/scope at capability boundaries; do not implicitly import media. Upload bytes with `PutArtifactRequest` or explicitly download finite HTTP(S) content with `ImportArtifactRequest` via `/app/artifact/put` and `/app/artifact/import`. Storage metadata and upload transports retain their MIME and byte fields. Resolve to temporary delivery URLs only at consumers. Conversation media sources retain their existing tagged artifact protocol. Video storage remains unsupported by the runtimes.
@@ -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,8 +1,13 @@
1
1
  {
2
2
  "manifest": "mhome.artifact.v1",
3
- "contractVersion": "1.1.1",
3
+ "contractVersion": "1.3.0",
4
4
  "uriPrefix": "meow-artifact://v1/",
5
- "kinds": ["image", "audio", "video", "file"],
5
+ "kinds": [
6
+ "image",
7
+ "audio",
8
+ "video",
9
+ "file"
10
+ ],
6
11
  "resolve": {
7
12
  "target": "/artifact/resolve",
8
13
  "schema": "schema/artifact-resolve.v1.schema.json",
@@ -12,5 +17,18 @@
12
17
  "target": "/artifact/put",
13
18
  "schema": "schema/artifact-put.v1.schema.json",
14
19
  "schemaVersion": 1
20
+ },
21
+ "uploadPrepare": {
22
+ "target": "/artifact/upload/prepare",
23
+ "schema": "schema/artifact-upload.v1.schema.json",
24
+ "schemaVersion": 1
25
+ },
26
+ "mediaReference": {
27
+ "schema": "schema/media-reference.v1.schema.json",
28
+ "schemaVersion": 1
29
+ },
30
+ "import": {
31
+ "schema": "schema/artifact-import.v1.schema.json",
32
+ "schemaVersion": 1
15
33
  }
16
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mhome/artifact-protocol",
3
- "version": "1.1.1",
3
+ "version": "1.3.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,19 @@
1
1
  {
2
2
  "protocol": "mhome.artifact",
3
- "contractVersion": "1.1.1",
3
+ "contractVersion": "1.3.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
+ "artifactImport": "schema/artifact-import.v1.schema.json",
10
+ "mediaReference": "schema/media-reference.v1.schema.json",
11
+ "artifactUpload": "schema/artifact-upload.v1.schema.json"
9
12
  },
10
13
  "fixtures": {
11
14
  "artifactReference": "fixtures/artifact-reference.conformance.json",
12
15
  "artifactResolve": "fixtures/artifact-resolve.conformance.json",
13
- "artifactPut": "fixtures/artifact-put.conformance.json"
16
+ "artifactPut": "fixtures/artifact-put.conformance.json",
17
+ "artifactUpload": "fixtures/artifact-upload.conformance.json"
14
18
  }
15
19
  }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mhome.ai/schema/artifact-import.v1.schema.json",
4
+ "title": "MeowLink artifact import request",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "kind",
9
+ "sourceUrl"
10
+ ],
11
+ "properties": {
12
+ "kind": {
13
+ "enum": [
14
+ "IMAGE",
15
+ "AUDIO",
16
+ "FILE"
17
+ ]
18
+ },
19
+ "sourceUrl": {
20
+ "type": "string",
21
+ "pattern": "^https?://",
22
+ "minLength": 8
23
+ },
24
+ "mimeType": {
25
+ "type": "string",
26
+ "minLength": 3,
27
+ "maxLength": 255
28
+ }
29
+ }
30
+ }
@@ -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
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mhome.ai/schema/media-reference.v1.schema.json",
4
+ "title": "MeowLink media reference",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "uri"
9
+ ],
10
+ "properties": {
11
+ "uri": {
12
+ "type": "string",
13
+ "pattern": "^meow-artifact://v1/",
14
+ "maxLength": 2048
15
+ }
16
+ }
17
+ }