feat(host): expose memcard controls and qualify process persistence
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good

This commit is contained in:
2026-10-30 10:10:07 +00:00
parent dcf6561ea7
commit a4bec5bc45
42 changed files with 4778 additions and 100 deletions
@@ -45,5 +45,59 @@
"requestId": "null-params",
"command": "get_state",
"params": null
},
{
"requestId": "bad-mem-8",
"command": "memcard_mount",
"params": {
"path": "x",
"action": "create",
"access": "read_only"
}
},
{
"requestId": "bad-mem-9",
"command": "memcard_mount",
"params": {
"path": "x",
"action": "open"
}
},
{
"requestId": "bad-mem-10",
"command": "boot",
"params": {
"path": "x",
"memcardChoice": null
}
},
{
"requestId": "bad-mem-11",
"command": "boot",
"params": {
"path": "x",
"memcardChoice": "auto"
}
},
{
"requestId": "bad-mem-12",
"command": "shutdown",
"params": {
"discardUnsaved": null
}
},
{
"requestId": "bad-mem-13",
"command": "reset",
"params": {
"pendingWrites": "save"
}
},
{
"requestId": "bad-mem-14",
"command": "get_memcard_state",
"params": {
"anything": true
}
}
]
+135 -3
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://prometeu.dev/headless/v1/request.schema.json",
"title": "Prometeu Headless v1 Request",
"title": "Prometeu Headless v1.1 Request",
"type": "object",
"additionalProperties": false,
"required": [
@@ -65,6 +65,13 @@
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"memcardChoice": {
"enum": [
"persistent",
"memory_fresh",
"memory_existing"
]
}
}
}
@@ -129,7 +136,19 @@
},
"params": {
"type": "object",
"maxProperties": 0
"properties": {
"discardUnsaved": {
"type": "boolean"
},
"pendingWrites": {
"enum": [
"wait",
"cancel"
]
}
},
"required": [],
"additionalProperties": false
}
}
},
@@ -184,7 +203,120 @@
},
"params": {
"type": "object",
"maxProperties": 0
"properties": {
"discardUnsaved": {
"type": "boolean"
},
"pendingWrites": {
"enum": [
"wait",
"cancel"
]
}
},
"required": [],
"additionalProperties": false
}
}
},
{
"properties": {
"command": {
"const": "memcard_mount"
},
"params": {
"type": "object",
"properties": {
"path": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"action": {
"enum": [
"open",
"create"
]
},
"access": {
"enum": [
"read_write",
"read_only"
]
}
},
"required": [
"path",
"action",
"access"
],
"additionalProperties": false,
"not": {
"properties": {
"action": {
"const": "create"
},
"access": {
"const": "read_only"
}
},
"required": [
"action",
"access"
]
}
}
}
},
{
"properties": {
"command": {
"const": "memcard_unmount"
},
"params": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
}
}
},
{
"properties": {
"command": {
"const": "get_memcard_state"
},
"params": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
}
}
},
{
"properties": {
"command": {
"const": "memcard_reconcile"
},
"params": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
}
}
},
{
"properties": {
"command": {
"const": "memcard_continue_in_memory"
},
"params": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
}
}
}
+74
View File
@@ -74,5 +74,79 @@
"params": {
"targetRequestId": "advance"
}
},
{
"requestId": "mem-11",
"command": "initialize",
"params": {
"protocolVersion": {
"major": 1,
"minor": 1
},
"requiredCapabilities": [
"memcard"
]
}
},
{
"requestId": "mem-12",
"command": "memcard_mount",
"params": {
"path": "/save.pmc",
"action": "open",
"access": "read_only"
}
},
{
"requestId": "mem-13",
"command": "memcard_mount",
"params": {
"path": "/new.pmc",
"action": "create",
"access": "read_write"
}
},
{
"requestId": "mem-14",
"command": "boot",
"params": {
"path": "/cartridge",
"memcardChoice": "memory_existing"
}
},
{
"requestId": "mem-15",
"command": "get_memcard_state",
"params": {}
},
{
"requestId": "mem-16",
"command": "memcard_unmount",
"params": {}
},
{
"requestId": "mem-17",
"command": "memcard_reconcile",
"params": {}
},
{
"requestId": "mem-18",
"command": "memcard_continue_in_memory",
"params": {}
},
{
"requestId": "mem-19",
"command": "reset",
"params": {
"discardUnsaved": true,
"pendingWrites": "cancel"
}
},
{
"requestId": "mem-20",
"command": "shutdown",
"params": {
"pendingWrites": "wait"
}
}
]
+400 -7
View File
@@ -1,7 +1,7 @@
{
"$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.",
"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",
@@ -167,12 +167,18 @@
"properties": {
"closed": {
"const": true
},
"memcard": {
"$ref": "#/$defs/memcard"
}
},
"required": [
"closed"
],
"additionalProperties": false
},
{
"$ref": "#/$defs/memcard"
}
]
}
@@ -222,7 +228,42 @@
"message",
"details"
],
"additionalProperties": false
"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": [
@@ -271,8 +312,24 @@
"const": "heap_ref"
},
"value": {
"type": "integer",
"minimum": 0
"type": "object",
"properties": {
"index": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
"generation": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
}
},
"required": [
"index",
"generation"
],
"additionalProperties": false
}
},
"required": [
@@ -347,6 +404,9 @@
"terminated",
"faulted"
]
},
"memcard": {
"$ref": "#/$defs/memcard"
}
},
"required": [
@@ -694,7 +754,8 @@
"faulted",
"terminated",
"canceled",
"host_error"
"host_error",
"action_required"
]
},
"fault": {
@@ -952,7 +1013,7 @@
"DuplicateFn",
"StructuralTypeCycle",
"CaptureIndex",
"CaptureCount",
"CaptureCount",
"CapturedDirectCall",
"RemovedOpcode",
"ArrayCycle",
@@ -1368,6 +1429,338 @@
"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
}
}
}