Schema reference
Machine-readable JSON Schemas for every protocol message, published byte-identical
from the reference implementation (packages/protocol/schemas/). A validator passing
a schema has not validated the frame — some normative rules (refinements) are not
expressible in JSON Schema; the spec text governs.
app-announce
Section titled “app-announce”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { "appId": { "maxLength": 128, "minLength": 1, "type": "string" }, "description": { "maxLength": 400, "type": "string" }, "displayName": { "maxLength": 80, "minLength": 1, "type": "string" }, "iconColor": { "maxLength": 32, "type": "string" }, "iconEmoji": { "maxLength": 8, "type": "string" }, "type": { "const": "snug:app-announce", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "appId", "displayName" ], "type": "object"}app-cancel
Section titled “app-cancel”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { "instanceId": { "maxLength": 128, "minLength": 1, "type": "string" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "type": { "const": "snug:app-cancel", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "instanceId" ], "type": "object"}app-event
Section titled “app-event”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { "data": {}, "event": { "maxLength": 64, "minLength": 1, "type": "string" }, "type": { "const": "snug:app-event", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "event" ], "type": "object"}app-message
Section titled “app-message”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { "action": { "maxLength": 128, "minLength": 1, "type": "string" }, "appId": { "maxLength": 128, "minLength": 1, "type": "string" }, "instanceId": { "maxLength": 128, "minLength": 1, "type": "string" }, "payload": {}, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "responseSchema": {}, "state": {}, "type": { "const": "snug:app-message", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "instanceId", "appId", "action" ], "type": "object"}app-request-envelope
Section titled “app-request-envelope”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { "action": { "maxLength": 128, "minLength": 1, "type": "string" }, "appId": { "maxLength": 128, "minLength": 1, "type": "string" }, "instanceId": { "maxLength": 128, "minLength": 1, "type": "string" }, "payload": {}, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "responseSchema": {}, "snug": { "const": 1, "type": "number" }, "state": {} }, "required": [ "snug", "appId", "instanceId", "requestId", "action" ], "type": "object"}app-response
Section titled “app-response”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "properties": { "ok": { "const": true, "type": "boolean" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "seq": { "maximum": 9007199254740991, "minimum": 0, "type": "integer" }, "streaming": { "const": true, "type": "boolean" }, "text": { "type": "string" }, "type": { "const": "snug:app-response", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "ok", "streaming", "text" ], "type": "object" }, { "properties": { "data": { "additionalProperties": {}, "propertyNames": { "type": "string" }, "type": "object" }, "ok": { "const": true, "type": "boolean" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "streaming": { "const": false, "type": "boolean" }, "type": { "const": "snug:app-response", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "ok", "streaming", "data" ], "type": "object" }, { "properties": { "error": { "properties": { "attemptsRemaining": { "maximum": 9007199254740991, "minimum": 0, "type": "integer" }, "code": { "maxLength": 64, "minLength": 1, "type": "string" }, "message": { "type": "string" }, "rawExcerpt": { "maxLength": 200, "type": "string" }, "retryable": { "type": "boolean" } }, "required": [ "code", "message", "retryable" ], "type": "object" }, "ok": { "const": false, "type": "boolean" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "type": { "const": "snug:app-response", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "ok", "error" ], "type": "object" } ]}db-request
Section titled “db-request”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "oneOf": [ { "properties": { "instanceId": { "maxLength": 128, "minLength": 1, "type": "string" }, "op": { "const": "exec", "type": "string" }, "params": { "items": {}, "type": "array" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "sql": { "minLength": 1, "type": "string" }, "type": { "const": "snug:db-request", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "instanceId", "op", "sql" ], "type": "object" }, { "properties": { "instanceId": { "maxLength": 128, "minLength": 1, "type": "string" }, "op": { "const": "export", "type": "string" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "type": { "const": "snug:db-request", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "instanceId", "op" ], "type": "object" }, { "properties": { "bytesBase64": { "minLength": 1, "type": "string" }, "instanceId": { "maxLength": 128, "minLength": 1, "type": "string" }, "op": { "const": "import", "type": "string" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "type": { "const": "snug:db-request", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "instanceId", "op", "bytesBase64" ], "type": "object" }, { "properties": { "instanceId": { "maxLength": 128, "minLength": 1, "type": "string" }, "key": { "maxLength": 256, "minLength": 1, "type": "string" }, "op": { "const": "kvGet", "type": "string" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "type": { "const": "snug:db-request", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "instanceId", "op", "key" ], "type": "object" }, { "properties": { "instanceId": { "maxLength": 128, "minLength": 1, "type": "string" }, "key": { "maxLength": 256, "minLength": 1, "type": "string" }, "op": { "const": "kvSet", "type": "string" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "type": { "const": "snug:db-request", "type": "string" }, "v": { "const": 1, "type": "number" }, "value": {} }, "required": [ "v", "type", "requestId", "instanceId", "op", "key", "value" ], "type": "object" } ]}db-response
Section titled “db-response”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "properties": { "bytesBase64": { "type": "string" }, "columns": { "items": { "type": "string" }, "type": "array" }, "ok": { "const": true, "type": "boolean" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "rows": { "items": { "items": {}, "type": "array" }, "type": "array" }, "type": { "const": "snug:db-response", "type": "string" }, "v": { "const": 1, "type": "number" }, "value": {} }, "required": [ "v", "type", "requestId", "ok" ], "type": "object" }, { "properties": { "error": { "properties": { "attemptsRemaining": { "maximum": 9007199254740991, "minimum": 0, "type": "integer" }, "code": { "maxLength": 64, "minLength": 1, "type": "string" }, "message": { "type": "string" }, "rawExcerpt": { "maxLength": 200, "type": "string" }, "retryable": { "type": "boolean" } }, "required": [ "code", "message", "retryable" ], "type": "object" }, "ok": { "const": false, "type": "boolean" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "type": { "const": "snug:db-response", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "ok", "error" ], "type": "object" } ]}host-event
Section titled “host-event”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { "data": {}, "event": { "maxLength": 64, "minLength": 1, "type": "string" }, "type": { "const": "snug:host-event", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "event" ], "type": "object"}host-ready
Section titled “host-ready”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { "capabilities": { "properties": { "auth": { "type": "boolean" }, "db": { "type": "boolean" }, "net": { "type": "boolean" }, "openUrl": { "type": "boolean" }, "streaming": { "type": "boolean" } }, "required": [ "streaming", "db", "auth" ], "type": "object" }, "instanceId": { "maxLength": 128, "minLength": 1, "type": "string" }, "locale": { "maxLength": 32, "type": "string" }, "protocolVersions": { "items": { "exclusiveMinimum": 0, "maximum": 9007199254740991, "type": "integer" }, "type": "array" }, "theme": { "enum": [ "light", "dark" ], "type": "string" }, "type": { "const": "snug:host-ready", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "instanceId", "protocolVersions", "capabilities", "theme" ], "type": "object"}net-request
Section titled “net-request”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, "properties": { "body": { "maxLength": 262144, "type": "string" }, "headers": { "additionalProperties": { "maxLength": 4096, "type": "string" }, "propertyNames": { "maxLength": 128, "minLength": 1, "type": "string" }, "type": "object" }, "instanceId": { "maxLength": 128, "minLength": 1, "type": "string" }, "method": { "enum": [ "GET", "HEAD", "POST", "PUT", "PATCH", "DELETE" ], "type": "string" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "type": { "const": "snug:net-request", "type": "string" }, "url": { "maxLength": 4096, "minLength": 1, "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "instanceId", "url", "method" ], "type": "object"}net-response
Section titled “net-response”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "additionalProperties": false, "properties": { "body": { "type": "string" }, "headers": { "additionalProperties": { "type": "string" }, "propertyNames": { "type": "string" }, "type": "object" }, "ok": { "const": true, "type": "boolean" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "status": { "maximum": 599, "minimum": 100, "type": "integer" }, "truncated": { "type": "boolean" }, "type": { "const": "snug:net-response", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "ok", "status", "headers", "body" ], "type": "object" }, { "additionalProperties": false, "properties": { "error": { "properties": { "attemptsRemaining": { "maximum": 9007199254740991, "minimum": 0, "type": "integer" }, "code": { "maxLength": 64, "minLength": 1, "type": "string" }, "message": { "type": "string" }, "rawExcerpt": { "maxLength": 200, "type": "string" }, "retryable": { "type": "boolean" } }, "required": [ "code", "message", "retryable" ], "type": "object" }, "ok": { "const": false, "type": "boolean" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "type": { "const": "snug:net-response", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "ok", "error" ], "type": "object" } ]}open-url-request
Section titled “open-url-request”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, "properties": { "instanceId": { "maxLength": 128, "minLength": 1, "type": "string" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "type": { "const": "snug:open-url-request", "type": "string" }, "url": { "maxLength": 2048, "minLength": 1, "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "instanceId", "url" ], "type": "object"}open-url-result
Section titled “open-url-result”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, "properties": { "reason": { "maxLength": 300, "type": "string" }, "requestId": { "maxLength": 128, "minLength": 1, "type": "string" }, "status": { "enum": [ "opened", "declined", "refused" ], "type": "string" }, "type": { "const": "snug:open-url-result", "type": "string" }, "v": { "const": 1, "type": "number" } }, "required": [ "v", "type", "requestId", "status" ], "type": "object"}