{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.checkfu.com/harness-oneshot-v1-authoring.schema.json",
  "title": "Checkfu oneshot-v1 harness release authoring",
  "description": "Structural authoring schema for the universal one-process-per-turn harness floor. Checkfu also applies the cross-field placeholder checks described in the extension guide.",
  "$ref": "#/$defs/CreateOneShotHarnessReleaseContract",
  "$defs": {
    "OciImageReference": {
      "type": "string"
    },
    "HarnessConfigurationSchemaObject": {
      "type": "object",
      "additionalProperties": {
        "description": "A value in the JSON data model: null, boolean, finite number, string, array, or object.",
        "allOf": [
          {
            "x-checkfu-json-budget": {
              "maximumBytes": 65536,
              "maximumDepth": 32,
              "maximumNodes": 4000,
              "maximumInspectionWork": 4000
            }
          }
        ]
      },
      "allOf": [
        {
          "x-checkfu-json-budget": {
            "maximumBytes": 65536,
            "maximumDepth": 32,
            "maximumNodes": 4000,
            "maximumInspectionWork": 4000
          }
        },
        {
          "maxProperties": 4000,
          "description": "harness configuration schema of at most 64 KiB, depth 32, and 4,000 nodes"
        }
      ]
    },
    "HarnessProcessArgumentUtf8Bytes": {
      "type": "string",
      "allOf": [
        {
          "maxLength": 65536
        },
        {
          "pattern": "^[^\\u0000]*$",
          "description": "Exact process argument text, preserving whitespace; U+0000 is forbidden and UTF-8 encoding is limited to 65536 bytes"
        }
      ]
    },
    "OneShotArgvPlaceholders": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/HarnessProcessArgumentUtf8Bytes"
      },
      "allOf": [
        {
          "maxItems": 256,
          "description": "At most 256 exact process arguments and 131072 aggregate UTF-8 bytes including one terminator per argument"
        }
      ]
    },
    "CreateOneShotHarnessReleaseContract": {
      "type": "object",
      "properties": {
        "image": {
          "$ref": "#/$defs/OciImageReference"
        },
        "entrypoint": {
          "type": "string",
          "allOf": [
            {
              "maxLength": 4096
            },
            {
              "pattern": "^\\/(?!\\.{1,2}(?:\\/|$))[A-Za-z0-9._-]+(?:\\/(?!\\.{1,2}(?:\\/|$))[A-Za-z0-9._-]+)*$"
            }
          ]
        },
        "working_directory": {
          "anyOf": [
            {
              "type": "string",
              "allOf": [
                {
                  "maxLength": 4096
                },
                {
                  "pattern": "^\\/(?!\\.{1,2}(?:\\/|$))[A-Za-z0-9._-]+(?:\\/(?!\\.{1,2}(?:\\/|$))[A-Za-z0-9._-]+)*$"
                }
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "platform": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "os": {
                  "type": "string",
                  "enum": [
                    "linux"
                  ]
                },
                "architecture": {
                  "type": "string",
                  "enum": [
                    "amd64",
                    "arm64"
                  ]
                }
              },
              "required": [
                "os",
                "architecture"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "configuration_schema": {
          "anyOf": [
            {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "$ref": "#/$defs/HarnessConfigurationSchemaObject"
                }
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "model_wire_dialects": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "anthropic_messages",
                  "openai_chat",
                  "openai_responses",
                  "fal_queue"
                ]
              },
              "allOf": [
                {
                  "minItems": 1
                },
                {
                  "maxItems": 4
                },
                {
                  "uniqueItems": true
                }
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "protocol": {
          "type": "string",
          "enum": [
            "oneshot-v1"
          ]
        },
        "arguments": {
          "anyOf": [
            {
              "not": {}
            },
            {
              "type": "null"
            }
          ]
        },
        "mcp_delivery": {
          "anyOf": [
            {
              "not": {}
            },
            {
              "type": "null"
            }
          ]
        },
        "argv": {
          "$ref": "#/$defs/OneShotArgvPlaceholders"
        },
        "prompt_transport": {
          "type": "string",
          "enum": [
            "stdin",
            "argv_path"
          ]
        },
        "output_mode": {
          "type": "string",
          "enum": [
            "stream_json",
            "text"
          ]
        },
        "resume_flag": {
          "anyOf": [
            {
              "type": "string",
              "allOf": [
                {
                  "maxLength": 65536
                },
                {
                  "pattern": "^[^\\u0000]*$",
                  "description": "Exact process argument text, preserving whitespace; U+0000 is forbidden and UTF-8 encoding is limited to 65536 bytes"
                },
                {
                  "minLength": 1
                }
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "output_schema_flag": {
          "anyOf": [
            {
              "type": "string",
              "allOf": [
                {
                  "maxLength": 65536
                },
                {
                  "pattern": "^[^\\u0000]*$",
                  "description": "Exact process argument text, preserving whitespace; U+0000 is forbidden and UTF-8 encoding is limited to 65536 bytes"
                },
                {
                  "minLength": 1
                }
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "output_schema_transport": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "argv_json",
                "argv_path"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "image",
        "entrypoint",
        "protocol",
        "argv",
        "prompt_transport",
        "output_mode"
      ],
      "additionalProperties": false
    }
  }
}
