{
  "$defs": {
    "DiffArguments": {
      "additionalProperties": false,
      "examples": [
        {
          "run_a": "0123456789ab",
          "run_b": "abcdef012345"
        }
      ],
      "properties": {
        "run_a": {
          "description": "First recorded Run identity or unique lowercase prefix; comparison is directional from A to B.",
          "pattern": "^[0-9a-f]{12,64}$",
          "title": "Run A",
          "type": "string"
        },
        "run_b": {
          "description": "Second recorded Run identity or unique lowercase prefix; differences describe evidence, never causality.",
          "pattern": "^[0-9a-f]{12,64}$",
          "title": "Run B",
          "type": "string"
        }
      },
      "required": [
        "run_a",
        "run_b"
      ],
      "title": "DiffArguments",
      "type": "object"
    },
    "Eligibility": {
      "additionalProperties": false,
      "properties": {
        "allow_conditional": {
          "default": false,
          "description": "Allow selected capabilities with CONDITIONAL readiness in their required repository evidence to be proposed, subject to all other planner checks. CONDITIONAL does not become READY; ambiguous or unsupported evidence is not made eligible.",
          "title": "Allow Conditional",
          "type": "boolean"
        }
      },
      "title": "Eligibility",
      "type": "object"
    },
    "Execution": {
      "additionalProperties": false,
      "properties": {
        "allowed": {
          "description": "Explicit nonempty set of acceptable execution modes. No ranking, implicit default or fallback. Compatibility must also satisfy the startup readiness policy; selecting a mode does not execute or authorize anything.",
          "items": {
            "enum": [
              "direct",
              "local-process",
              "oci-container"
            ],
            "type": "string"
          },
          "minItems": 1,
          "title": "Allowed",
          "type": "array"
        },
        "require": {
          "default": [],
          "description": "Explicit execution controls that every compatible proposed mode must support. These requirements narrow compatibility; they do not grant operator permissions or attest to a live runtime.",
          "items": {
            "enum": [
              "wall_timeout",
              "input_limit",
              "output_limit",
              "environment",
              "working_directory",
              "network_deny",
              "filesystem_sandbox",
              "subprocess_deny",
              "memory_limit",
              "cpu_limit",
              "pid_limit"
            ],
            "type": "string"
          },
          "title": "Require",
          "type": "array"
        }
      },
      "required": [
        "allowed"
      ],
      "title": "Execution",
      "type": "object"
    },
    "ExposurePolicy": {
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "const": "apizr.exposure-policy/v1",
          "default": "apizr.exposure-policy/v1",
          "description": "Version identifier for this exposure planning constraint contract; not operator authorization.",
          "title": "Schema Version",
          "type": "string"
        },
        "selection": {
          "$ref": "#/$defs/Selection",
          "description": "Explicit capability selection proposal; empty defaults do not select every capability."
        },
        "interfaces": {
          "description": "Nonempty requested generated interface set: rest and/or mcp. Planning checks compatibility for every interface; it does not generate, deploy or run them.",
          "items": {
            "enum": [
              "rest",
              "mcp"
            ],
            "type": "string"
          },
          "minItems": 1,
          "title": "Interfaces",
          "type": "array"
        },
        "eligibility": {
          "$ref": "#/$defs/Eligibility",
          "description": "Readiness eligibility constraints for selected capabilities; cannot replace missing or uncertain evidence."
        },
        "execution": {
          "$ref": "#/$defs/Execution",
          "description": "Explicit acceptable execution modes and required controls for compatibility planning, not permission to execute."
        }
      },
      "required": [
        "interfaces",
        "execution"
      ],
      "title": "ExposurePolicy",
      "type": "object"
    },
    "InspectArguments": {
      "additionalProperties": false,
      "properties": {
        "source": {
          "description": "Saved Python script or notebook relative to the operator-selected project root.",
          "maxLength": 1024,
          "minLength": 1,
          "pattern": "^(?!~)(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\\\:\\x00-\\x1f\\x7f])[^/]+(?:/[^/]+)*$",
          "title": "Source",
          "type": "string"
        },
        "module_name": {
          "anyOf": [
            {
              "maxLength": 128,
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional logical Python module name; omitted uses the saved file stem.",
          "title": "Module Name"
        }
      },
      "required": [
        "source"
      ],
      "title": "InspectArguments",
      "type": "object"
    },
    "ListArguments": {
      "additionalProperties": false,
      "examples": [
        {},
        {
          "limit": 5,
          "status": "failed"
        }
      ],
      "properties": {
        "status": {
          "anyOf": [
            {
              "enum": [
                "success",
                "failed",
                "cancelled"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional exact recorded status; all records are validated before this display filter.",
          "title": "Status"
        },
        "source": {
          "anyOf": [
            {
              "maxLength": 1024,
              "minLength": 1,
              "pattern": "^(?!~)(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\\\:\\x00-\\x1f\\x7f])[^/]+(?:/[^/]+)*$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional exact recorded project-relative source reference, never a filesystem target.",
          "title": "Source"
        },
        "capability": {
          "anyOf": [
            {
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional exact recorded capability identity; SDK sessions may have none.",
          "title": "Capability"
        },
        "limit": {
          "default": 20,
          "description": "Maximum displayed Runs, from 1 to 1000; does not reduce validation of the complete bounded history.",
          "maximum": 1000,
          "minimum": 1,
          "title": "Limit",
          "type": "integer"
        }
      },
      "title": "ListArguments",
      "type": "object"
    },
    "NoArguments": {
      "additionalProperties": false,
      "properties": {},
      "title": "NoArguments",
      "type": "object"
    },
    "PlanArguments": {
      "additionalProperties": false,
      "properties": {
        "policy": {
          "anyOf": [
            {
              "$ref": "#/$defs/ExposurePolicy"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Explicit proposal policy, or the startup project policy when omitted; grants no generation or execution authority."
        }
      },
      "title": "PlanArguments",
      "type": "object"
    },
    "Selection": {
      "additionalProperties": false,
      "properties": {
        "include": {
          "default": [],
          "description": "Exact canonical capability IDs explicitly proposed for exposure, for example python:model:predict. No fuzzy matching or implicit dependency exposure.",
          "items": {
            "type": "string"
          },
          "title": "Include",
          "type": "array"
        },
        "include_all_ready": {
          "default": false,
          "description": "Add capabilities assessed READY in the repository readiness report to the requested selection before exclusions. All planner eligibility, interface and execution checks still apply; this grants no publication or operator authority.",
          "title": "Include All Ready",
          "type": "boolean"
        },
        "exclude": {
          "default": [],
          "description": "Exact capability IDs removed after combining include and include_all_ready. Unknown IDs in either include or exclude are refused.",
          "items": {
            "type": "string"
          },
          "title": "Exclude",
          "type": "array"
        }
      },
      "title": "Selection",
      "type": "object"
    },
    "ShowArguments": {
      "additionalProperties": false,
      "examples": [
        {
          "run_id": "0123456789ab"
        }
      ],
      "properties": {
        "run_id": {
          "description": "Full recorded Run SHA-256 or unique lowercase prefix of 12 to 64 hexadecimal characters; ambiguity refuses the request.",
          "pattern": "^[0-9a-f]{12,64}$",
          "title": "Run Id",
          "type": "string"
        }
      },
      "required": [
        "run_id"
      ],
      "title": "ShowArguments",
      "type": "object"
    }
  },
  "additionalProperties": false,
  "allOf": [
    {
      "if": {
        "properties": {
          "operation": {
            "const": "capabilities"
          }
        }
      },
      "then": {
        "properties": {
          "arguments": {
            "$ref": "#/$defs/NoArguments"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "operation": {
            "const": "inspect"
          }
        }
      },
      "then": {
        "properties": {
          "arguments": {
            "$ref": "#/$defs/InspectArguments"
          }
        },
        "required": [
          "arguments"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "operation": {
            "const": "experiment_list"
          }
        }
      },
      "then": {
        "properties": {
          "arguments": {
            "$ref": "#/$defs/ListArguments"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "operation": {
            "const": "experiment_show"
          }
        }
      },
      "then": {
        "properties": {
          "arguments": {
            "$ref": "#/$defs/ShowArguments"
          }
        },
        "required": [
          "arguments"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "operation": {
            "const": "experiment_diff"
          }
        }
      },
      "then": {
        "properties": {
          "arguments": {
            "$ref": "#/$defs/DiffArguments"
          }
        },
        "required": [
          "arguments"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "operation": {
            "const": "plan_exposure"
          }
        }
      },
      "then": {
        "properties": {
          "arguments": {
            "$ref": "#/$defs/PlanArguments"
          }
        }
      }
    }
  ],
  "properties": {
    "schema_version": {
      "const": "apizr.editor/v1",
      "default": "apizr.editor/v1",
      "title": "Schema Version",
      "type": "string"
    },
    "request_id": {
      "default": "request",
      "maxLength": 64,
      "minLength": 1,
      "pattern": "^[A-Za-z0-9_.-]+$",
      "title": "Request Id",
      "type": "string"
    },
    "operation": {
      "enum": [
        "capabilities",
        "inspect",
        "experiment_list",
        "experiment_show",
        "experiment_diff",
        "plan_exposure"
      ],
      "title": "Operation",
      "type": "string"
    },
    "arguments": {
      "anyOf": [
        {
          "$ref": "#/$defs/NoArguments"
        },
        {
          "$ref": "#/$defs/InspectArguments"
        },
        {
          "$ref": "#/$defs/ListArguments"
        },
        {
          "$ref": "#/$defs/ShowArguments"
        },
        {
          "$ref": "#/$defs/DiffArguments"
        },
        {
          "$ref": "#/$defs/PlanArguments"
        }
      ],
      "default": {},
      "title": "Arguments"
    }
  },
  "required": [
    "operation"
  ],
  "title": "EditorRequest",
  "type": "object"
}
