{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Prometeu headless server messages v1.0", "$comment": "requestId additionally has a 128 UTF-8-byte bound; uint counters require lossless decoding. v1.0 producers are checked strictly. Consumers must allow compatible minor extensions.", "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 } }, "required": [ "closed" ], "additionalProperties": false } ] } }, "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 }, "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": "integer", "minimum": 0 } }, "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" ] } }, "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" ] }, "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 } ] } } }