{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unpkg.com/context-room@latest/schemas/codex-prompt-publication-state-v2.schema.json",
  "title": "Codex prompt publication state v2",
  "description": "Strict schema for prompt-overrides/.publication-state.json.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "nextGeneration",
    "globalOwnerGeneration",
    "runtimeRegistryGenerations",
    "runtimeOwnerGenerations"
  ],
  "properties": {
    "schemaVersion": {
      "const": 2
    },
    "nextGeneration": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "globalOwnerGeneration": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "runtimeRegistryGenerations": {
      "type": "object",
      "propertyNames": {
        "pattern": "^[1-9][0-9]{0,9}$"
      },
      "additionalProperties": {
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      }
    },
    "runtimeOwnerGenerations": {
      "type": "object",
      "propertyNames": {
        "pattern": "^[1-9][0-9]{0,9}$"
      },
      "additionalProperties": {
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      }
    }
  },
  "$comment": "Context Room additionally requires runtimeRegistryGenerations and runtimeOwnerGenerations to have exactly the same keys; every key must be the canonical decimal representation of a non-zero u32 PID. globalOwnerGeneration must be lower than nextGeneration. Every runtime generation must be at least 1 and lower than nextGeneration, with runtimeRegistryGenerations[pid] less than or equal to runtimeOwnerGenerations[pid]. Batch receipt verification keeps only the owner-generation vector for PIDs with verified receipt proofs stable; registry generations are validated structurally but are not receipt-freshness keys. nextGeneration, globalOwnerGeneration, registry generations, and unrelated PID owners may advance independently. A conforming publisher allocates a fresh owner generation before every receipt publication or tombstone."
}
