{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:orbiplex:schema:operator-task-experiment-draft:v1",
  "title": "Operator Task Experiment Draft v1",
  "x-dia-workflow": "project",
  "x-dia-status": "draft",
  "x-dia-basis": [
    "doc/project/40-proposals/094-operator-task-packs-for-bounded-problem-solving.md"
  ],
  "description": "Inert Solver-authored publication input, not a plan. The host reads it only from the exact retained Agent product. Each attachment names exactly one patch step; that step must name draft-patch:<step/id> and the same patch-policy/ref. The host validates all material and derives content addresses before publication. Total decoded written content is at most 1 MiB, across all attachments; enclosing product and evidence budgets also apply. Independent review, plan policy admission and HIL remain mandatory.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "schema/v", "candidate", "patches"],
  "properties": {
    "schema": {"const": "operator-task-experiment-draft.v1"},
    "schema/v": {"const": 1},
    "candidate": {"$ref": "operator-task-experiment-candidate.v1.schema.json"},
    "patches": {
      "type": "array",
      "maxItems": 64,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["step/id"],
        "oneOf": [{"required": ["patch"]}, {"required": ["patch/text"]}],
        "properties": {
          "step/id": {"$ref": "operator-task-common.v1.schema.json#/$defs/name"},
          "patch": {"$ref": "operator-task-patch.v1.schema.json"},
          "patch/text": {"$ref": "#/$defs/text-patch"}
        }
      },
      "description": "Ordered attachments. Semantic admission rejects duplicate or missing step ids, unconsumed local refs and ref/policy substitution. Empty for observation-only drafts."
    }
  },
  "$defs": {
    "text-patch": {
      "type": "object",
      "additionalProperties": false,
      "required": ["patch-policy/ref", "files"],
      "properties": {
        "patch-policy/ref": {"$ref": "operator-task-common.v1.schema.json#/$defs/ref"},
        "files": {
          "type": "array", "minItems": 1, "maxItems": 64,
          "items": {
            "type": "object", "additionalProperties": false,
            "required": ["root/ref", "path", "content/text"],
            "properties": {
              "root/ref": {"$ref": "operator-task-common.v1.schema.json#/$defs/ref"},
              "path": {"$ref": "operator-task-patch.v1.schema.json#/$defs/file/properties/path"},
              "content/text": {
                "type": "string", "maxLength": 1048576,
                "description": "Complete resulting UTF-8 file, not a diff. Semantic admission counts actual UTF-8 bytes, sharing the draft's 1 MiB budget with binary attachments. Mechanical encoding preserves Unicode and line endings exactly; policy admission remains separate."
              }
            }
          }
        }
      },
      "description": "Write-only authoring representation, converted to the unchanged operator-task-patch.v1. No content selection or normalization; use patch for binary files or deletion."
    }
  }
}
