{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Prometeu headless server messages v1.1", "$comment": "Producer schema for supported 1.0/1.1 shapes. Consumers permit compatible minor additions; 64-bit identities require lossless decoding.", "oneOf": [ { "type": "object", "properties": { "type": { "const": "hello" }, "sessionId": { "type": "string", "minLength": 1 }, "protocolVersion": { "$ref": "#/$defs/version" }, "runtimeVersion": { "type": "string", "minLength": 1 }, "capabilities": { "type": "array", "items": { "type": "string" } }, "limits": { "$ref": "#/$defs/limits" } }, "required": [ "type", "sessionId", "protocolVersion", "runtimeVersion", "capabilities", "limits" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "const": "progress" }, "sessionId": { "type": "string", "minLength": 1 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "requested": { "type": "integer", "minimum": 0 }, "completed": { "type": "integer", "minimum": 0 } }, "required": [ "type", "sessionId", "requestId", "requested", "completed" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "const": "response" }, "sessionId": { "type": "string", "minLength": 1 }, "requestId": { "type": [ "string", "null" ], "minLength": 1, "maxLength": 128 }, "error": { "$ref": "#/$defs/error" } }, "required": [ "type", "sessionId", "requestId", "error" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "const": "response" }, "sessionId": { "type": "string", "minLength": 1 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "result": { "anyOf": [ { "$ref": "#/$defs/negotiated" }, { "$ref": "#/$defs/state" }, { "$ref": "#/$defs/advance" }, { "$ref": "#/$defs/capture" }, { "$ref": "#/$defs/fault" }, { "type": "null" }, { "type": "object", "properties": {}, "required": [], "additionalProperties": false }, { "type": "object", "properties": { "targetRequestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "requested": { "const": true } }, "required": [ "targetRequestId", "requested" ], "additionalProperties": false }, { "type": "object", "properties": { "closed": { "const": true }, "memcard": { "$ref": "#/$defs/memcard" } }, "required": [ "closed" ], "additionalProperties": false }, { "$ref": "#/$defs/memcard" } ] } }, "required": [ "type", "sessionId", "requestId", "result" ], "additionalProperties": false } ], "$defs": { "version": { "type": "object", "properties": { "major": { "const": 1 }, "minor": { "type": "integer", "minimum": 0 } }, "required": [ "major", "minor" ], "additionalProperties": false }, "error": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "details": { "type": "object" } }, "required": [ "code", "message", "details" ], "additionalProperties": false, "allOf": [ { "if": { "properties": { "code": { "const": "memcard_error" } } }, "then": { "properties": { "details": { "type": "object", "properties": { "operation": { "type": "string" }, "reason": { "$ref": "#/$defs/memcardReason" }, "state": { "$ref": "#/$defs/memcard" } }, "required": [ "operation", "reason", "state" ], "additionalProperties": false } } } } ] }, "stack": { "oneOf": [ { "type": "object", "properties": { "kind": { "const": "int32" }, "value": { "type": "integer", "minimum": -2147483648, "maximum": 2147483647 } }, "required": [ "kind", "value" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "enum": [ "int64", "float64", "string" ] }, "value": { "type": "string" } }, "required": [ "kind", "value" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "const": "heap_ref" }, "value": { "type": "object", "properties": { "index": { "type": "integer", "minimum": 0, "maximum": 4294967295 }, "generation": { "type": "integer", "minimum": 0, "maximum": 4294967295 } }, "required": [ "index", "generation" ], "additionalProperties": false } }, "required": [ "kind", "value" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "const": "boolean" }, "value": { "type": "boolean" } }, "required": [ "kind", "value" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "const": "null" }, "value": { "type": "null" } }, "required": [ "kind", "value" ], "additionalProperties": false } ] }, "state": { "type": "object", "properties": { "pc": { "type": "integer", "minimum": 0 }, "stackTop": { "type": "array", "items": { "$ref": "#/$defs/stack" } }, "logicalFrameIndex": { "type": "integer", "minimum": 0 }, "tickIndex": { "type": "integer", "minimum": 0 }, "appId": { "type": "integer", "minimum": 0 }, "status": { "enum": [ "running", "paused", "terminated", "faulted" ] }, "memcard": { "$ref": "#/$defs/memcard" } }, "required": [ "pc", "stackTop", "logicalFrameIndex", "tickIndex", "appId", "status" ], "additionalProperties": false }, "fault": { "oneOf": [ { "type": "object", "properties": { "pc": { "type": [ "integer", "null" ], "minimum": 0 }, "summary": { "type": "string" }, "kind": { "const": "vm_trap" }, "trap": { "type": "object", "properties": { "code": { "type": "integer", "minimum": 0 }, "opcode": { "type": "integer", "minimum": 0 }, "message": { "type": "string" }, "pc": { "type": "integer", "minimum": 0 }, "span": { "anyOf": [ { "$ref": "#/$defs/sourceSpan" }, { "type": "null" } ] }, "resource": { "anyOf": [ { "$ref": "#/$defs/resourceFailure" }, { "type": "null" } ] } }, "required": [ "code", "opcode", "message", "pc", "span", "resource" ], "additionalProperties": false } }, "required": [ "pc", "summary", "kind", "trap" ], "additionalProperties": false }, { "type": "object", "properties": { "pc": { "type": [ "integer", "null" ], "minimum": 0 }, "summary": { "type": "string" }, "kind": { "const": "vm_panic" }, "message": { "type": "string" } }, "required": [ "pc", "summary", "kind", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "pc": { "type": [ "integer", "null" ], "minimum": 0 }, "summary": { "type": "string" }, "kind": { "const": "vm_init" }, "initError": { "oneOf": [ { "type": "object", "properties": { "code": { "const": "registry_load_failed" }, "message": { "type": "string" }, "load": { "$ref": "#/$defs/loadFailure" } }, "required": [ "code", "message", "load" ], "additionalProperties": false }, { "type": "object", "properties": { "code": { "const": "runtime_resource_limit" }, "message": { "type": "string" }, "resource": { "$ref": "#/$defs/resourceFailure" } }, "required": [ "code", "message", "resource" ], "additionalProperties": false }, { "type": "object", "properties": { "code": { "const": "entrypoint_arguments_invalid" }, "message": { "type": "string" }, "entry": { "type": "object", "properties": { "function": { "type": "integer", "minimum": 0, "maximum": 4294967295 }, "slot": { "type": "integer", "minimum": 0, "maximum": 4294967295 }, "trapCode": { "type": "integer", "minimum": 0, "maximum": 4294967295 } }, "required": [ "function", "slot", "trapCode" ], "additionalProperties": false } }, "required": [ "code", "message", "entry" ], "additionalProperties": false }, { "type": "object", "properties": { "code": { "const": "loader_patch_failed" }, "message": { "type": "string" }, "binding": { "$ref": "#/$defs/bindingFailure" } }, "required": [ "code", "message", "binding" ], "additionalProperties": false }, { "type": "object", "properties": { "code": { "const": "invalid_format" }, "message": { "type": "string" } }, "required": [ "code", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "code": { "const": "unsupported_format" }, "message": { "type": "string" } }, "required": [ "code", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "code": { "const": "image_load_failed" }, "message": { "type": "string" } }, "required": [ "code", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "code": { "const": "entrypoint_not_found" }, "message": { "type": "string" } }, "required": [ "code", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "code": { "const": "verification_failed" }, "message": { "type": "string" } }, "required": [ "code", "message" ], "additionalProperties": false } ] } }, "required": [ "pc", "summary", "kind", "initError" ], "additionalProperties": false } ] }, "advance": { "type": "object", "properties": { "requested": { "type": "integer", "minimum": 0 }, "completed": { "type": "integer", "minimum": 0 }, "stop": { "enum": [ "completed", "faulted", "terminated", "canceled", "host_error", "action_required" ] }, "fault": { "$ref": "#/$defs/fault" }, "error": { "$ref": "#/$defs/error" } }, "required": [ "requested", "completed", "stop" ], "additionalProperties": false, "allOf": [ { "if": { "properties": { "stop": { "const": "faulted" } } }, "then": { "required": [ "fault" ] } }, { "if": { "properties": { "stop": { "const": "host_error" } } }, "then": { "required": [ "error" ] } } ] }, "capture": { "type": "object", "properties": { "mimeType": { "const": "image/png" }, "encoding": { "const": "base64" }, "data": { "type": "string", "contentEncoding": "base64" }, "width": { "type": "integer", "minimum": 1 }, "height": { "type": "integer", "minimum": 1 }, "stridePixels": { "type": "integer", "minimum": 1 }, "pixelFormat": { "const": "RGBA8888" }, "logicalFrameIndex": { "type": "integer", "minimum": 0 }, "frameId": { "type": "integer", "minimum": 0 } }, "required": [ "mimeType", "encoding", "data", "width", "height", "stridePixels", "pixelFormat", "logicalFrameIndex", "frameId" ], "additionalProperties": false }, "negotiated": { "type": "object", "properties": { "protocolVersion": { "$ref": "#/$defs/version" }, "capabilities": { "type": "array", "items": { "type": "string" } } }, "required": [ "protocolVersion", "capabilities" ], "additionalProperties": false }, "limits": { "type": "object", "properties": { "maxFrames": { "type": "integer", "minimum": 1 }, "maxCommandBytes": { "type": "integer", "minimum": 1 }, "maxResponseBytes": { "type": "integer", "minimum": 1 }, "handshakeTimeoutMs": { "type": "integer", "minimum": 1 }, "callTimeoutMs": { "type": "integer", "minimum": 1 }, "shutdownTimeoutMs": { "type": "integer", "minimum": 1 } }, "required": [ "maxFrames", "maxCommandBytes", "maxResponseBytes", "handshakeTimeoutMs", "callTimeoutMs", "shutdownTimeoutMs" ], "additionalProperties": false }, "resourceFailure": { "type": "object", "properties": { "resource": { "enum": [ "GuestBytes", "HandleSlots", "AuxiliaryBytes", "TemporaryBytes", "StringBytes", "StringAllocations", "IndividualStringBytes", "CallDepth" ] }, "reason": { "enum": [ "Limit", "SizeOverflow", "AllocationFailed" ] }, "requested": { "type": "integer", "minimum": 0 }, "limit": { "type": "integer", "minimum": 0 } }, "required": [ "resource", "reason", "requested", "limit" ], "additionalProperties": false }, "sourceSpan": { "type": "object", "properties": { "file_id": { "type": "integer", "minimum": 0, "maximum": 4294967295 }, "start": { "type": "integer", "minimum": 0, "maximum": 4294967295 }, "end": { "type": "integer", "minimum": 0, "maximum": 4294967295 } }, "required": [ "file_id", "start", "end" ], "additionalProperties": false }, "loadFailure": { "type": "object", "properties": { "code": { "enum": [ "LOAD_INVALID_FORMAT", "LOAD_UNSUPPORTED_FORMAT", "LOAD_INVALID_REFERENCE", "LOAD_INVALID_REGISTRY", "LOAD_INVALID_CODE", "LOAD_RESOURCE_LIMIT", "LOAD_INVALID_ENTRYPOINT" ] }, "reason": { "enum": [ "Magic", "Version", "Endianness", "Reserved", "SectionKind", "MissingSection", "DuplicateSection", "Overlap", "Truncated", "TrailingBytes", "InvalidFlag", "Utf8", "Category", "Builtin", "TypeId", "FunctionId", "OwnerCategory", "TraitCategory", "DuplicateBuiltin", "DuplicateArray", "DuplicateFn", "StructuralTypeCycle", "CaptureIndex", "CaptureCount", "CapturedDirectCall", "RemovedOpcode", "ArrayCycle", "DuplicateImplementation", "MethodCount", "Signature", "CodeRange", "FrameSlots", "ReturnSlots", "Overflow", "Limit", "Allocation", "ConstantTag", "DebugRange", "DuplicateSyscall", "UnknownOpcode", "LocalSlot", "JumpTarget", "InstructionBoundary", "BooleanImmediate", "ConstantIndex", "NativeId", "UnpatchedHostcall", "StackUnderflow", "StackOverflow", "StackJoin", "ReturnHeight", "UnterminatedPath", "UnknownClosureCallee", "NotClosure", "InvalidYield", "TypeMismatch" ] }, "section": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 4294967295 }, { "type": "null" } ] }, "record": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 4294967295 }, { "type": "null" } ] }, "member": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 4294967295 }, { "type": "null" } ] }, "referenced_id": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 4294967295 }, { "type": "null" } ] }, "function": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 4294967295 }, { "type": "null" } ] }, "pc": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 4294967295 }, { "type": "null" } ] }, "offset": { "anyOf": [ { "type": "integer", "minimum": 0 }, { "type": "null" } ] }, "id_domain": { "enum": [ "Type", "Function", "Implementation", null ] }, "resource": { "enum": [ "PbxBytes", "CodeBytes", "Types", "Functions", "Implementations", "NestedRecords", "NameBytes", "RegistryBytes", "TemporaryBytes", "Work", "ConstantEntries", "ConstantStringBytes", null ] }, "requested": { "anyOf": [ { "type": "integer", "minimum": 0 }, { "type": "null" } ] }, "limit": { "anyOf": [ { "type": "integer", "minimum": 0 }, { "type": "null" } ] } }, "required": [ "code", "reason", "section", "record", "member", "referenced_id", "function", "pc", "offset", "id_domain", "resource", "requested", "limit" ], "additionalProperties": false }, "bindingFailure": { "oneOf": [ { "type": "object", "properties": { "reason": { "const": "unknown_syscall" }, "module": { "type": "string" }, "name": { "type": "string" }, "version": { "type": "integer", "minimum": 0, "maximum": 65535 } }, "required": [ "reason", "module", "name", "version" ], "additionalProperties": false }, { "type": "object", "properties": { "reason": { "const": "missing_capability" }, "module": { "type": "string" }, "name": { "type": "string" }, "version": { "type": "integer", "minimum": 0, "maximum": 65535 }, "required": { "type": "integer", "minimum": 0 }, "provided": { "type": "integer", "minimum": 0 } }, "required": [ "reason", "module", "name", "version", "required", "provided" ], "additionalProperties": false }, { "type": "object", "properties": { "reason": { "const": "abi_mismatch" }, "module": { "type": "string" }, "name": { "type": "string" }, "version": { "type": "integer", "minimum": 0, "maximum": 65535 }, "declared_arg_slots": { "type": "integer", "minimum": 0, "maximum": 65535 }, "declared_ret_slots": { "type": "integer", "minimum": 0, "maximum": 65535 }, "expected_arg_slots": { "type": "integer", "minimum": 0, "maximum": 65535 }, "expected_ret_slots": { "type": "integer", "minimum": 0, "maximum": 65535 } }, "required": [ "reason", "module", "name", "version", "declared_arg_slots", "declared_ret_slots", "expected_arg_slots", "expected_ret_slots" ], "additionalProperties": false }, { "type": "object", "properties": { "reason": { "const": "hostcall_index_out_of_bounds" }, "pc": { "type": "integer", "minimum": 0 }, "syscallIndex": { "type": "integer", "minimum": 0, "maximum": 4294967295 }, "syscallsLength": { "type": "integer", "minimum": 0 } }, "required": [ "reason", "pc", "syscallIndex", "syscallsLength" ], "additionalProperties": false }, { "type": "object", "properties": { "reason": { "const": "raw_syscall" }, "pc": { "type": "integer", "minimum": 0 }, "syscallId": { "type": "integer", "minimum": 0, "maximum": 4294967295 } }, "required": [ "reason", "pc", "syscallId" ], "additionalProperties": false }, { "type": "object", "properties": { "reason": { "const": "unused_syscall" }, "module": { "type": "string" }, "name": { "type": "string" }, "version": { "type": "integer", "minimum": 0, "maximum": 65535 }, "syscallIndex": { "type": "integer", "minimum": 0, "maximum": 4294967295 } }, "required": [ "reason", "module", "name", "version", "syscallIndex" ], "additionalProperties": false }, { "type": "object", "properties": { "reason": { "const": "hostcall_remaining" }, "pc": { "type": "integer", "minimum": 0 }, "syscallIndex": { "type": "integer", "minimum": 0, "maximum": 4294967295 } }, "required": [ "reason", "pc", "syscallIndex" ], "additionalProperties": false }, { "type": "object", "properties": { "reason": { "const": "decode_failed" } }, "required": [ "reason" ], "additionalProperties": false } ] }, "memcardReason": { "enum": [ "choice_required", "unavailable", "corrupt", "unsupported", "read_only", "access_denied", "already_exists", "busy", "no_space", "out_of_memory", "invalid_state", "invalid_range", "counter_exhausted", "identity_mismatch", "unsaved_changes", "indeterminate", "restart_required", "io_error", "canceled" ] }, "memcard": { "type": "object", "properties": { "media": { "type": "object", "properties": { "path": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "cardId": { "anyOf": [ { "type": "string", "pattern": "^[0-9a-f]{32}$" }, { "type": "null" } ] }, "access": { "anyOf": [ { "enum": [ "read_write", "read_only" ] }, { "type": "null" } ] }, "mountEpoch": { "type": "string", "pattern": "^(0|[1-9][0-9]*)$" }, "preparation": { "enum": [ "idle", "pending", "ready", "failed" ] }, "error": { "anyOf": [ { "$ref": "#/$defs/memcardReason" }, { "type": "null" } ] }, "recovered": { "type": "boolean" }, "degraded": { "type": "boolean" }, "writeBlocked": { "type": "boolean" } }, "required": [ "path", "cardId", "access", "mountEpoch", "preparation", "error", "recovered", "degraded", "writeBlocked" ], "additionalProperties": false }, "session": { "type": "object", "properties": { "appId": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 4294967295 }, { "type": "null" } ] }, "choice": { "anyOf": [ { "enum": [ "persistent", "memory_fresh", "memory_existing" ] }, { "type": "null" } ] }, "mode": { "anyOf": [ { "enum": [ "persistent", "memory_only" ] }, { "type": "null" } ] }, "bootAttempted": { "type": "boolean" }, "bootPhase": { "enum": [ "idle", "loading", "choice_required", "preparing", "running", "failed" ] }, "resident": { "type": "boolean" }, "actionRequired": { "type": "boolean" } }, "required": [ "appId", "choice", "mode", "bootAttempted", "bootPhase", "resident", "actionRequired" ], "additionalProperties": false }, "dirty": { "type": "boolean" }, "dirtySlots": { "type": "array", "items": { "type": "integer", "minimum": 0, "maximum": 63 }, "uniqueItems": true, "maxItems": 64 }, "request": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "pattern": "^(0|[1-9][0-9]*)$" }, "state": { "enum": [ "pending", "success", "failure", "indeterminate", "memory_only" ] }, "reason": { "anyOf": [ { "$ref": "#/$defs/memcardReason" }, { "enum": [ "none", "timeout" ] } ] }, "storageError": { "anyOf": [ { "$ref": "#/$defs/memcardReason" }, { "type": "null" } ] }, "operation": { "enum": [ "commit", "presentation" ] }, "slot": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 63 }, { "type": "null" } ] }, "retained": { "type": "boolean" } }, "required": [ "id", "state", "reason", "storageError", "operation", "slot", "retained" ], "additionalProperties": false }, { "type": "null" } ] }, "io": { "type": "object", "properties": { "active": { "type": "boolean" }, "deferred": { "type": "boolean" }, "phase": { "enum": [ "idle", "preparing", "deferred", "queued", "running", "returned" ] } }, "required": [ "active", "deferred", "phase" ], "additionalProperties": false }, "recovery": { "type": "object", "properties": { "removalPending": { "type": "boolean" }, "reconciliationRequired": { "type": "boolean" }, "restartRequired": { "type": "boolean" } }, "required": [ "removalPending", "reconciliationRequired", "restartRequired" ], "additionalProperties": false } }, "required": [ "media", "session", "dirty", "dirtySlots", "request", "io", "recovery" ], "additionalProperties": false } } }