{
  "openapi": "3.1.0",
  "info": {
    "title": "Queryfill API",
    "version": "0.1.0",
    "description": "Interpret requirements into validated filters, labels, component descriptors, objects and application-owned action plans. Server-side secret keys only."
  },
  "servers": [
    {
      "url": "https://api.queryfill.com",
      "description": "Production"
    },
    {
      "url": "https://api-staging.queryfill.com",
      "description": "Staging"
    },
    {
      "url": "http://localhost:8787",
      "description": "Local development"
    }
  ],
  "security": [
    {
      "ApiKey": []
    }
  ],
  "paths": {
    "/v1/pricing": {
      "get": {
        "operationId": "getPublishedPricing",
        "summary": "Current request pricing, top-up estimates and workspace limits",
        "security": [],
        "responses": {
          "200": {
            "description": "Current versioned request cost, free credits, top-up estimates (assuming no sales tax), free/paid limits and cache lifetime. Top-up estimates do not create a payment or replace a checkout quote.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "infrastructure",
                    "limits",
                    "cache_ttl_seconds",
                    "daily_free_credits_micros",
                    "topups",
                    "topup_estimate_basis"
                  ],
                  "properties": {
                    "daily_free_credits_micros": {
                      "type": "string",
                      "pattern": "^\\d+$",
                      "description": "Exact integer quantity encoded as a string."
                    },
                    "topup_estimate_basis": {
                      "type": "string"
                    },
                    "topups": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "amount_minor",
                          "currency",
                          "estimated_credits_micros"
                        ],
                        "properties": {
                          "amount_minor": {
                            "type": "string",
                            "pattern": "^\\d+$",
                            "description": "Exact integer quantity encoded as a string."
                          },
                          "currency": {
                            "type": "string",
                            "enum": [
                              "USD"
                            ]
                          },
                          "estimated_credits_micros": {
                            "type": "string",
                            "pattern": "^\\d+$",
                            "description": "Exact integer quantity encoded as a string."
                          }
                        }
                      }
                    },
                    "infrastructure": {
                      "type": "object",
                      "required": [
                        "credits_micros",
                        "credits",
                        "pricing_version",
                        "basis"
                      ],
                      "properties": {
                        "credits_micros": {
                          "type": "string"
                        },
                        "credits": {
                          "type": "string"
                        },
                        "pricing_version": {
                          "type": "string"
                        },
                        "basis": {
                          "type": "string"
                        }
                      }
                    },
                    "limits": {
                      "type": "object"
                    },
                    "cache_ttl_seconds": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/parse": {
      "post": {
        "operationId": "parseQuery",
        "summary": "Parse a query against a published schema",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Reuse the exact key and body for retries of this operation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ParseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resolved, partially resolved, or unresolved intent.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Idempotency-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ParseResponse"
                }
              }
            }
          },
          "400": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "504": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/runs": {
      "post": {
        "operationId": "executeParsingRun",
        "summary": "Execute one bounded parsing run with managed AI; BYOK is currently disabled",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Reuse the exact key and body for retries of this operation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ParseRunRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Committed parsing result and original platform/provider usage receipt.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Idempotency-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ParseRunResponse"
                }
              }
            }
          },
          "400": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "504": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "description": "Foundation API. Subscription provisioning is local-only. One committed valid result consumes one platform run, including unresolved results and cache hits. Identical idempotent retries replay the original receipt without new consumption. Provider calls and measured tokens are separate. Credit caps and Jev output-token limits are rejected. Existing credit workspaces must continue using /v1/parse.",
        "x-standard-schema-limits": {
          "max_schema_fields": 25,
          "max_schema_values": 500,
          "max_schema_bytes": 256000,
          "max_total_aliases": 2000
        },
        "servers": [
          {
            "url": "https://api-staging.queryfill.com",
            "description": "Verified PRD staging release"
          },
          {
            "url": "http://localhost:8787",
            "description": "Local subscription foundation"
          }
        ]
      }
    },
    "/v2/evaluate": {
      "post": {
        "operationId": "evaluateConfiguredOutputs",
        "summary": "Evaluate a published contract with filters, labels, component descriptors, bounded objects and registered workflow plans",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Reuse the exact key and body for retries of this operation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SemanticEvaluationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Committed typed output result; optional output failures remain explicit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SemanticEvaluationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "504": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "description": "Uses existing project authentication, credit/subscription accounting and idempotency. Required outputs cannot be omitted. Capabilities are supplied by a trusted backend. Component data and rendering stay in the customer application. Unknown decisions are unresolved, never false. Realtime is rejected until performance-qualified. No managed dispatch or continuations.",
        "servers": [
          {
            "url": "https://api-staging.queryfill.com",
            "description": "Verified PRD staging release"
          },
          {
            "url": "http://localhost:8787",
            "description": "Local semantic builder implementation"
          }
        ]
      }
    },
    "/v2/plans": {
      "get": {
        "operationId": "listPackages",
        "summary": "Draft package catalog; no checkout quote",
        "security": [],
        "responses": {
          "200": {
            "description": "Free, Solo, Growth and Team with separate parsing and indexing allowances."
          }
        }
      }
    },
    "/v3/evaluate": {
      "post": {
        "operationId": "evaluateRequirements",
        "summary": "Evaluate requirements with safe partial output projection",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Reuse the exact key and body for retries of this operation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SemanticEvaluationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Requirement-aware response. Inspect completeness and execution eligibility before applying outputs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contract",
                    "requirements",
                    "logic",
                    "support",
                    "outputs",
                    "relaxation_required",
                    "requirement_issues"
                  ],
                  "properties": {
                    "timing": {
                      "$ref": "#/components/schemas/ExecutionTiming"
                    },
                    "contract": {
                      "const": "queryfill.evaluate/3.0"
                    },
                    "status": {
                      "enum": [
                        "resolved",
                        "partially_resolved",
                        "unresolved"
                      ]
                    },
                    "requirements": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "logic": {
                      "type": "object"
                    },
                    "support": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "requirement_issues": {
                      "type": "array",
                      "description": "Bounded contradiction and logical-scope diagnostics. A contradiction blocks affected executable outputs; requirements and independent annotations are preserved.",
                      "items": {
                        "type": "object",
                        "required": [
                          "code",
                          "requirement_ids",
                          "message"
                        ],
                        "properties": {
                          "code": {
                            "enum": [
                              "CONTRADICTORY_REQUIREMENTS",
                              "AMBIGUOUS_SCOPE"
                            ]
                          },
                          "requirement_ids": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "message": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "outputs": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "required": [
                          "status",
                          "completeness",
                          "execution_eligibility"
                        ],
                        "properties": {
                          "status": {
                            "enum": [
                              "ready",
                              "absent",
                              "unresolved",
                              "blocked",
                              "not_requested"
                            ]
                          },
                          "completeness": {
                            "enum": [
                              "complete",
                              "incomplete"
                            ]
                          },
                          "execution_eligibility": {
                            "enum": [
                              "eligible",
                              "requires_explicit_relaxation",
                              "requires_application_authorization",
                              "blocked",
                              "not_applicable"
                            ]
                          },
                          "value": {
                            "description": "Filters use a logical AST in v3; other outputs retain typed values."
                          }
                        }
                      }
                    },
                    "relaxation_required": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "504": {
            "description": "Structured API error. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "description": "Uses existing project authentication, credit/subscription accounting and idempotency. Required outputs cannot be omitted. Capabilities are supplied by a trusted backend. Component data and rendering stay in the customer application. Unknown decisions are unresolved, never false. Realtime is rejected until performance-qualified. No managed dispatch or continuations.",
        "servers": [
          {
            "url": "https://api-staging.queryfill.com",
            "description": "Verified PRD staging release"
          },
          {
            "url": "http://localhost:8787",
            "description": "Local semantic builder implementation"
          }
        ]
      }
    },
    "/public/evaluate": {
      "post": {
        "operationId": "evaluatePublicExample",
        "servers": [
          {
            "url": "https://api-staging.queryfill.com",
            "description": "PRD staging release"
          },
          {
            "url": "http://localhost:8787",
            "description": "Local development"
          }
        ],
        "summary": "Try a temporary schema anonymously",
        "description": "Sponsored and rate/budget limited. Uses the standard requirement-aware engine without persistent schema changes or action execution. The evaluation object is authoritative; the flat filters preview contains only positive conjuncts and must not replace its logical AST.",
        "security": [],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "query",
                  "schema"
                ],
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "schema": {
                    "$ref": "#/components/schemas/SchemaDocument"
                  },
                  "suggest_schema_changes": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "description": "At most 64 KB, 40 fields and 300 declared values. Realtime profiles are unavailable on the anonymous endpoint."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Inspect evaluation.status and each output's completeness and execution_eligibility. No action is executed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contract",
                    "request_id",
                    "evaluation",
                    "usage"
                  ],
                  "properties": {
                    "contract": {
                      "const": "queryfill.public-evaluate/1.0"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "evaluation": {
                      "type": "object",
                      "required": [
                        "contract",
                        "requirements",
                        "logic",
                        "support",
                        "outputs",
                        "relaxation_required",
                        "requirement_issues"
                      ],
                      "properties": {
                        "timing": {
                          "$ref": "#/components/schemas/ExecutionTiming"
                        },
                        "contract": {
                          "const": "queryfill.evaluate/3.0"
                        },
                        "status": {
                          "enum": [
                            "resolved",
                            "partially_resolved",
                            "unresolved"
                          ]
                        },
                        "requirements": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        },
                        "logic": {
                          "type": "object"
                        },
                        "support": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        },
                        "requirement_issues": {
                          "type": "array",
                          "description": "Bounded contradiction and logical-scope diagnostics. A contradiction blocks affected executable outputs; requirements and independent annotations are preserved.",
                          "items": {
                            "type": "object",
                            "required": [
                              "code",
                              "requirement_ids",
                              "message"
                            ],
                            "properties": {
                              "code": {
                                "enum": [
                                  "CONTRADICTORY_REQUIREMENTS",
                                  "AMBIGUOUS_SCOPE"
                                ]
                              },
                              "requirement_ids": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "message": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "outputs": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "object",
                            "required": [
                              "status",
                              "completeness",
                              "execution_eligibility"
                            ],
                            "properties": {
                              "status": {
                                "enum": [
                                  "ready",
                                  "absent",
                                  "unresolved",
                                  "blocked",
                                  "not_requested"
                                ]
                              },
                              "completeness": {
                                "enum": [
                                  "complete",
                                  "incomplete"
                                ]
                              },
                              "execution_eligibility": {
                                "enum": [
                                  "eligible",
                                  "requires_explicit_relaxation",
                                  "requires_application_authorization",
                                  "blocked",
                                  "not_applicable"
                                ]
                              },
                              "value": {
                                "description": "Filters use a logical AST in v3; other outputs retain typed values."
                              }
                            }
                          }
                        },
                        "relaxation_required": {
                          "type": "boolean"
                        }
                      }
                    },
                    "filters": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      },
                      "description": "Positive-conjunction preview only; use evaluation.outputs.filters.value for application logic."
                    },
                    "usage": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict or request still running; retry in-progress operations with the same key."
          },
          "422": {
            "description": "Invalid schema or unsupported public execution profile."
          },
          "429": {
            "description": "Anonymous request, concurrency or provider budget limit."
          },
          "503": {
            "description": "Public playground or provider temporarily unavailable."
          }
        }
      }
    },
    "/v3/jobs": {
      "post": {
        "operationId": "acceptManagedWorkflow",
        "summary": "Durably queue one explicitly authorized action",
        "description": "Opt-in environment feature. Requires a project key with actions:execute, a completed fully supported v3 workflow result, and an enabled action/version receiver. User text never grants authorization. Charges no additional parse. A 202 confirms persistence only; uncertain non-idempotent delivery requires reconciliation.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowJobRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Previously accepted job for this same key and body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job": {
                      "$ref": "#/components/schemas/WorkflowJob"
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "Durable job and outbox accepted; not completed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job": {
                      "$ref": "#/components/schemas/WorkflowJob"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Idempotency or state conflict."
          },
          "503": {
            "description": "Managed execution disabled."
          }
        }
      },
      "get": {
        "operationId": "listManagedJobs",
        "summary": "List current project jobs",
        "responses": {
          "200": {
            "description": "Project-scoped jobs."
          }
        }
      }
    },
    "/v3/jobs/{id}": {
      "get": {
        "operationId": "getManagedJob",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job state, checkpoint, accounting and event history.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job": {
                      "$ref": "#/components/schemas/WorkflowJob"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Job not found in this project."
          }
        }
      }
    },
    "/v3/jobs/{id}/cancel": {
      "post": {
        "operationId": "cancelQueuedJob",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Queued job canceled; remote work cannot be undone."
          },
          "409": {
            "description": "Job already dispatched or settled."
          }
        }
      }
    },
    "/v3/jobs/{id}/reconcile": {
      "post": {
        "operationId": "reconcileManagedJob",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Requires actions:execute and independently verified remote outcome. This does not rerun the receiver.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "state",
                  "reference",
                  "reason"
                ],
                "properties": {
                  "state": {
                    "type": "string",
                    "enum": [
                      "succeeded",
                      "failed"
                    ]
                  },
                  "reference": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 5
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reviewed outcome recorded."
          }
        }
      }
    },
    "/v3/flow-runs": {
      "post": {
        "operationId": "executeStandardFlow",
        "summary": "Run an immutable published standard flow",
        "description": "Up to 12 steps, four sequential semantic evaluations and four typed external reads. Each semantic step is a separate metered request. Automatic actions are never dispatched. Returns saved checkpoints when remaining deadline cannot admit the next step. Partial meaning stops dependent work for input review.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FlowRunRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Inspect state and per-step receipts; HTTP 200 is not a promise of completion.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FlowRun"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict or another worker is executing this flow."
          }
        }
      },
      "get": {
        "operationId": "listFlowRuns",
        "responses": {
          "200": {
            "description": "Latest project-scoped flow runs."
          }
        }
      }
    },
    "/v3/flow-runs/{id}": {
      "get": {
        "operationId": "getFlowRun",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Saved run and per-step receipts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FlowRun"
                }
              }
            }
          }
        }
      }
    },
    "/v3/flow-runs/{id}/resume": {
      "post": {
        "operationId": "resumeStandardFlow",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Checks current caller/project/schema/integration authority. Completed steps reuse their stored output. A repeated in-progress parse uses its original idempotency key. Awaiting-input runs require a revised query in a new run.",
        "responses": {
          "200": {
            "description": "Current or resumed run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FlowRun"
                }
              }
            }
          },
          "409": {
            "description": "Another worker holds the execution lease."
          }
        }
      }
    },
    "/v3/flow-runs/{id}/cancel": {
      "post": {
        "operationId": "cancelWaitingFlow",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Queued/checkpointed/awaiting-input flow canceled."
          },
          "409": {
            "description": "Running or terminal flow cannot be canceled."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Project-scoped server API key."
      }
    },
    "schemas": {
      "ParseRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "schema_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 140
          },
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "suggest_schema_changes": {
            "type": "boolean"
          },
          "max_credits_micros": {
            "type": "string",
            "pattern": "^\\d{1,16}$"
          },
          "context": {
            "type": "object",
            "properties": {
              "locale": {
                "type": "string",
                "maxLength": 30
              },
              "timezone": {
                "type": "string",
                "maxLength": 80
              }
            },
            "additionalProperties": false
          },
          "candidates": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "maxItems": 50,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "aliases": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 200
                    }
                  }
                },
                "required": [
                  "value",
                  "label"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "required": [
          "schema_id",
          "query"
        ],
        "additionalProperties": false
      },
      "SchemaDocument": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "key": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "fields": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "maxLength": 120
                },
                "key": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "description": {
                  "default": "",
                  "type": "string",
                  "maxLength": 1000
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "text",
                    "number",
                    "number_range",
                    "boolean",
                    "enum",
                    "multi_enum",
                    "date",
                    "date_range",
                    "currency",
                    "location",
                    "geo",
                    "hierarchical",
                    "entity"
                  ]
                },
                "operators": {
                  "minItems": 1,
                  "maxItems": 11,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "eq",
                      "neq",
                      "gt",
                      "gte",
                      "lt",
                      "lte",
                      "in",
                      "not_in",
                      "contains",
                      "between",
                      "exists"
                    ]
                  }
                },
                "value_mode": {
                  "default": "closed",
                  "type": "string",
                  "enum": [
                    "closed",
                    "open",
                    "dynamic"
                  ]
                },
                "values": {
                  "default": [],
                  "maxItems": 10000,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "value": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "label": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "aliases": {
                        "default": [],
                        "maxItems": 30,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      },
                      "enabled": {
                        "default": true,
                        "type": "boolean"
                      },
                      "origin": {
                        "default": "manual",
                        "type": "string",
                        "enum": [
                          "scraped",
                          "manual",
                          "imported",
                          "synced",
                          "system_inferred"
                        ]
                      },
                      "order": {
                        "default": 0,
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "parent": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "value",
                      "label",
                      "aliases",
                      "enabled",
                      "origin",
                      "order"
                    ],
                    "additionalProperties": false
                  }
                },
                "aliases": {
                  "default": [],
                  "maxItems": 30,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                },
                "enabled": {
                  "default": true,
                  "type": "boolean"
                },
                "origin": {
                  "default": "manual",
                  "type": "string",
                  "enum": [
                    "scraped",
                    "manual",
                    "imported",
                    "synced",
                    "system_inferred"
                  ]
                },
                "min": {
                  "anyOf": [
                    {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "string",
                          "pattern": "^-?\\d+(\\.\\d+)?$"
                        }
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "max": {
                  "anyOf": [
                    {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "string",
                          "pattern": "^-?\\d+(\\.\\d+)?$"
                        }
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "unit": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 30
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "currency": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "confidence": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                },
                "confirmed": {
                  "default": false,
                  "type": "boolean"
                },
                "selector": {
                  "type": "string",
                  "maxLength": 500
                },
                "parameter": {
                  "type": "string",
                  "maxLength": 120
                },
                "control_type": {
                  "type": "string",
                  "maxLength": 40
                },
                "default": {},
                "precision": {
                  "default": 0,
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 12
                },
                "metadata": {
                  "default": {},
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              },
              "required": [
                "id",
                "key",
                "label",
                "description",
                "type",
                "operators",
                "value_mode",
                "values",
                "aliases",
                "enabled",
                "origin",
                "confirmed",
                "precision",
                "metadata"
              ],
              "additionalProperties": false
            }
          },
          "record_terms": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          },
          "tombstones": {
            "default": [],
            "maxItems": 10000,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 200
            }
          },
          "semantic": {
            "type": "object",
            "properties": {
              "version": {
                "default": 1,
                "type": "number",
                "const": 1
              },
              "outputs": {
                "default": [],
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "filters",
                        "labels",
                        "components",
                        "object",
                        "workflow"
                      ]
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "required": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "kind",
                    "enabled",
                    "required"
                  ],
                  "additionalProperties": false
                }
              },
              "labels": {
                "default": [],
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "description": {
                      "default": "",
                      "type": "string",
                      "maxLength": 1000
                    },
                    "mode": {
                      "default": "span",
                      "type": "string",
                      "enum": [
                        "document",
                        "span"
                      ]
                    },
                    "mandatory": {
                      "default": false,
                      "type": "boolean"
                    },
                    "source": {
                      "default": "",
                      "type": "string",
                      "maxLength": 160
                    },
                    "value": {
                      "default": "",
                      "type": "string",
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "description",
                    "mode",
                    "mandatory",
                    "source",
                    "value"
                  ],
                  "additionalProperties": false
                }
              },
              "components": {
                "default": [],
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "selection": {
                      "default": "explicit",
                      "type": "string",
                      "enum": [
                        "explicit",
                        "default"
                      ]
                    },
                    "source": {
                      "default": "",
                      "type": "string",
                      "maxLength": 160
                    },
                    "value": {
                      "default": "",
                      "type": "string",
                      "maxLength": 200
                    },
                    "data_ref": {
                      "type": "string",
                      "pattern": "^[a-zA-Z][\\w.]{0,150}$"
                    },
                    "capabilities": {
                      "default": [],
                      "maxItems": 16,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                      }
                    },
                    "props": {
                      "default": [],
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "string",
                              "number",
                              "integer",
                              "boolean",
                              "array",
                              "object"
                            ]
                          },
                          "contract": {
                            "$ref": "#/components/schemas/ValueContract"
                          },
                          "source": {
                            "default": "",
                            "type": "string",
                            "maxLength": 160
                          },
                          "required": {
                            "default": false,
                            "type": "boolean"
                          },
                          "default": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 4000
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "min": {
                            "type": "number"
                          },
                          "max": {
                            "type": "number"
                          },
                          "values": {
                            "default": [],
                            "maxItems": 100,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "maxLength": 200
                            }
                          }
                        },
                        "required": [
                          "key",
                          "type",
                          "source",
                          "required",
                          "values"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "requires_complete_filters": {
                      "type": "boolean"
                    },
                    "actions": {
                      "maxItems": 16,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "navigate",
                              "workflow"
                            ]
                          },
                          "capability": {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                          },
                          "confirmation_required": {
                            "default": true,
                            "type": "boolean"
                          },
                          "requires_selected_record": {
                            "default": true,
                            "type": "boolean",
                            "const": true
                          }
                        },
                        "required": [
                          "id",
                          "label",
                          "kind",
                          "capability",
                          "confirmation_required",
                          "requires_selected_record"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "version",
                    "selection",
                    "source",
                    "value",
                    "data_ref",
                    "capabilities",
                    "props"
                  ],
                  "additionalProperties": false
                }
              },
              "objects": {
                "default": [],
                "maxItems": 16,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "fields": {
                      "default": [],
                      "maxItems": 64,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "string",
                              "number",
                              "integer",
                              "boolean",
                              "array",
                              "object"
                            ]
                          },
                          "contract": {
                            "$ref": "#/components/schemas/ValueContract"
                          },
                          "source": {
                            "default": "",
                            "type": "string",
                            "maxLength": 160
                          },
                          "required": {
                            "default": false,
                            "type": "boolean"
                          },
                          "default": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 4000
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "min": {
                            "type": "number"
                          },
                          "max": {
                            "type": "number"
                          },
                          "values": {
                            "default": [],
                            "maxItems": 100,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "maxLength": 200
                            }
                          }
                        },
                        "required": [
                          "key",
                          "type",
                          "source",
                          "required",
                          "values"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "requires_complete_filters": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "fields"
                  ],
                  "additionalProperties": false
                }
              },
              "workflows": {
                "default": [],
                "maxItems": 16,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "source": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 160
                    },
                    "value": {
                      "type": "string",
                      "maxLength": 200
                    },
                    "arguments": {
                      "default": [],
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "string",
                              "number",
                              "integer",
                              "boolean",
                              "array",
                              "object"
                            ]
                          },
                          "contract": {
                            "$ref": "#/components/schemas/ValueContract"
                          },
                          "source": {
                            "default": "",
                            "type": "string",
                            "maxLength": 160
                          },
                          "required": {
                            "default": false,
                            "type": "boolean"
                          },
                          "default": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 4000
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "min": {
                            "type": "number"
                          },
                          "max": {
                            "type": "number"
                          },
                          "values": {
                            "default": [],
                            "maxItems": 100,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "maxLength": 200
                            }
                          }
                        },
                        "required": [
                          "key",
                          "type",
                          "source",
                          "required",
                          "values"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "confirmation_required": {
                      "default": true,
                      "type": "boolean"
                    },
                    "requires_complete_filters": {
                      "default": true,
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "version",
                    "source",
                    "value",
                    "arguments",
                    "confirmation_required",
                    "requires_complete_filters"
                  ],
                  "additionalProperties": false
                }
              },
              "mappings": {
                "default": [],
                "maxItems": 64,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "source": {
                      "type": "string",
                      "maxLength": 160
                    },
                    "transform": {
                      "default": "identity",
                      "type": "string",
                      "enum": [
                        "identity",
                        "lookup",
                        "cast",
                        "coalesce",
                        "multiply",
                        "expression"
                      ]
                    },
                    "type": {
                      "default": "string",
                      "type": "string",
                      "enum": [
                        "string",
                        "number",
                        "integer",
                        "boolean",
                        "array",
                        "object"
                      ]
                    },
                    "expression": {
                      "$ref": "#/components/schemas/MappingExpression"
                    },
                    "contract": {
                      "$ref": "#/components/schemas/ValueContract"
                    },
                    "inputs": {
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "type": "string",
                            "maxLength": 160
                          },
                          "contract": {
                            "$ref": "#/components/schemas/ValueContract"
                          }
                        },
                        "required": [
                          "path",
                          "contract"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "lookup_version": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "entries": {
                      "default": [],
                      "maxItems": 256,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 4000
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "to": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 4000
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "factor": {
                      "default": 1,
                      "type": "number",
                      "minimum": -1000000000,
                      "maximum": 1000000000
                    },
                    "on_missing": {
                      "default": "unresolved",
                      "type": "string",
                      "enum": [
                        "unresolved",
                        "error",
                        "explicit_default"
                      ]
                    },
                    "default": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 4000
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "source",
                    "transform",
                    "type",
                    "entries",
                    "factor",
                    "on_missing"
                  ],
                  "additionalProperties": false
                }
              },
              "execution": {
                "default": {
                  "profile": "standard",
                  "deadline_ms": 10000,
                  "partial_results": true
                },
                "type": "object",
                "properties": {
                  "profile": {
                    "default": "standard",
                    "type": "string",
                    "enum": [
                      "standard",
                      "realtime"
                    ]
                  },
                  "deadline_ms": {
                    "default": 10000,
                    "type": "integer",
                    "minimum": 100,
                    "maximum": 30000
                  },
                  "partial_results": {
                    "default": true,
                    "type": "boolean"
                  }
                },
                "required": [
                  "profile",
                  "deadline_ms",
                  "partial_results"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "version",
              "outputs",
              "labels",
              "components",
              "objects",
              "workflows",
              "mappings",
              "execution"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "key",
          "fields",
          "tombstones"
        ],
        "additionalProperties": false
      },
      "Filter": {
        "type": "object",
        "required": [
          "field",
          "operator",
          "value",
          "confidence"
        ],
        "properties": {
          "field": {
            "type": "string"
          },
          "operator": {
            "type": "string",
            "enum": [
              "eq",
              "neq",
              "gt",
              "gte",
              "lt",
              "lte",
              "in",
              "not_in",
              "contains",
              "between",
              "exists"
            ]
          },
          "value": {
            "description": "Type-checked scalar, array, ISO date or geographic point. Exact large numbers and decimals may be strings."
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        }
      },
      "Unresolved": {
        "type": "object",
        "required": [
          "text",
          "code",
          "message"
        ],
        "properties": {
          "text": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "start": {
            "type": "integer"
          },
          "end": {
            "type": "integer"
          },
          "candidates": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Usage": {
        "type": "object",
        "required": [
          "credits",
          "credits_micros",
          "inference_micros",
          "infrastructure_micros",
          "infrastructure_pricing_version",
          "cache_hit",
          "reserved_micros",
          "released_micros",
          "provider",
          "model",
          "input_units",
          "output_units",
          "cost_pico",
          "mode"
        ],
        "properties": {
          "credits": {
            "type": "string",
            "pattern": "^\\d+\\.\\d{6}$"
          },
          "credits_micros": {
            "type": "string",
            "pattern": "^\\d+$",
            "description": "Exact integer quantity encoded as a string."
          },
          "inference_micros": {
            "type": "string",
            "pattern": "^\\d+$",
            "description": "Exact integer quantity encoded as a string."
          },
          "infrastructure_micros": {
            "type": "string",
            "pattern": "^\\d+$",
            "description": "Exact integer quantity encoded as a string."
          },
          "infrastructure_pricing_version": {
            "type": "string"
          },
          "cache_hit": {
            "type": "boolean"
          },
          "schema_suggestions_enabled": {
            "type": "boolean"
          },
          "schema_suggestion_questions": {
            "type": "integer",
            "minimum": 0
          },
          "reserved_micros": {
            "type": "string",
            "pattern": "^\\d+$",
            "description": "Exact integer quantity encoded as a string."
          },
          "released_micros": {
            "type": "string",
            "pattern": "^\\d+$",
            "description": "Exact integer quantity encoded as a string."
          },
          "cost_pico": {
            "type": "string",
            "pattern": "^\\d+$",
            "description": "Exact integer quantity encoded as a string."
          },
          "provider": {
            "type": "string"
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "input_units": {
            "type": "integer",
            "minimum": 0
          },
          "output_units": {
            "type": "integer",
            "minimum": 0
          },
          "pricing_version": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "mock",
              "live"
            ]
          }
        }
      },
      "SchemaSuggestion": {
        "type": "object",
        "description": "Review-only proposal; never modifies filters or a published schema.",
        "required": [
          "action",
          "field",
          "evidence",
          "reason",
          "proposed_change",
          "source",
          "confidence",
          "requires_review"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "add_value",
              "add_alias",
              "add_field",
              "review_schema",
              "provide_candidates"
            ]
          },
          "field": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidence": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "proposed_change": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "source": {
            "type": "string",
            "enum": [
              "rules",
              "jev"
            ]
          },
          "confidence": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 1
          },
          "requires_review": {
            "const": true
          }
        }
      },
      "ParseResponse": {
        "type": "object",
        "required": [
          "request_id",
          "schema_id",
          "schema_version",
          "status",
          "filters",
          "unresolved",
          "usage"
        ],
        "properties": {
          "request_id": {
            "type": "string"
          },
          "schema_id": {
            "type": "string"
          },
          "schema_version": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "resolved",
              "partially_resolved",
              "unresolved"
            ]
          },
          "filters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Filter"
            }
          },
          "unresolved": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Unresolved"
            }
          },
          "schema_suggestions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SchemaSuggestion"
            },
            "description": "Present when suggest_schema_changes is true; may be empty."
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "request_id",
          "error"
        ],
        "properties": {
          "request_id": {
            "type": "string"
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "retryable"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "details": {}
            }
          },
          "run": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string"
              }
            }
          },
          "usage": {
            "type": "object",
            "description": "Present for subscription failures after an operation has been claimed. Platform runs are zero; nullable provider tokens mean usage is unknown, not free.",
            "properties": {
              "billing_mode": {
                "const": "subscription"
              },
              "platform": {
                "type": "object",
                "properties": {
                  "runs": {
                    "const": 0
                  }
                }
              },
              "model": {
                "$ref": "#/components/schemas/RunUsage/properties/model"
              }
            }
          }
        }
      },
      "ParseRunRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "input": {
            "type": "object",
            "properties": {
              "schema_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 140
              },
              "query": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "suggest_schema_changes": {
                "type": "boolean"
              },
              "max_credits_micros": {
                "type": "string",
                "pattern": "^\\d{1,16}$"
              },
              "context": {
                "type": "object",
                "properties": {
                  "locale": {
                    "type": "string",
                    "maxLength": 30
                  },
                  "timezone": {
                    "type": "string",
                    "maxLength": 80
                  }
                },
                "additionalProperties": false
              },
              "candidates": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "maxItems": 50,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "value": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "label": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "aliases": {
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 200
                        }
                      }
                    },
                    "required": [
                      "value",
                      "label"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            },
            "required": [
              "schema_id",
              "query"
            ],
            "additionalProperties": false
          },
          "model_connection_id": {
            "description": "Reserved for existing clients. Rejected with BYOK_DISABLED while BYOK is disabled; omit for managed AI.",
            "type": "string",
            "minLength": 1,
            "maxLength": 140
          },
          "model_limits": {
            "type": "object",
            "properties": {
              "max_calls": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1
              },
              "max_output_tokens": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 1000000
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "input"
        ],
        "additionalProperties": false
      },
      "ExecutionIdentity": {
        "type": "object",
        "required": [
          "id",
          "function_id",
          "function_version",
          "step_id",
          "contract_version"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "function_id": {
            "type": "string"
          },
          "function_version": {
            "type": "string"
          },
          "step_id": {
            "type": "string"
          },
          "contract_version": {
            "type": "string"
          }
        }
      },
      "RunUsage": {
        "type": "object",
        "required": [
          "billing_mode",
          "platform",
          "model",
          "cache_hit",
          "mode"
        ],
        "properties": {
          "billing_mode": {
            "const": "subscription"
          },
          "platform": {
            "type": "object",
            "required": [
              "runs"
            ],
            "properties": {
              "runs": {
                "type": "integer",
                "enum": [
                  0,
                  1
                ]
              }
            }
          },
          "model": {
            "type": "object",
            "required": [
              "calls",
              "provider",
              "model",
              "input_tokens",
              "output_tokens",
              "billed_by"
            ],
            "properties": {
              "calls": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1,
                "description": "Dispatch attempts. One attempt does not prove receipt or a charge by the provider."
              },
              "provider": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "model": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "input_tokens": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "output_tokens": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "billed_by": {
                "const": "provider"
              }
            }
          },
          "cache_hit": {
            "type": "boolean"
          },
          "mode": {
            "type": "string",
            "enum": [
              "mock",
              "live"
            ]
          }
        }
      },
      "ParseRunResponse": {
        "type": "object",
        "required": [
          "request_id",
          "schema_id",
          "schema_version",
          "status",
          "filters",
          "unresolved",
          "usage",
          "run"
        ],
        "properties": {
          "request_id": {
            "type": "string"
          },
          "schema_id": {
            "type": "string"
          },
          "schema_version": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "resolved",
              "partially_resolved",
              "unresolved"
            ]
          },
          "filters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Filter"
            }
          },
          "unresolved": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Unresolved"
            }
          },
          "schema_suggestions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SchemaSuggestion"
            },
            "description": "Present when suggest_schema_changes is true; may be empty."
          },
          "usage": {
            "$ref": "#/components/schemas/RunUsage"
          },
          "run": {
            "$ref": "#/components/schemas/ExecutionIdentity"
          }
        }
      },
      "SemanticEvaluationRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "input": {
            "type": "object",
            "properties": {
              "schema_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 140
              },
              "query": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "suggest_schema_changes": {
                "type": "boolean"
              },
              "max_credits_micros": {
                "type": "string",
                "pattern": "^\\d{1,16}$"
              },
              "context": {
                "type": "object",
                "properties": {
                  "locale": {
                    "type": "string",
                    "maxLength": 30
                  },
                  "timezone": {
                    "type": "string",
                    "maxLength": 80
                  }
                },
                "additionalProperties": false
              },
              "candidates": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "maxItems": 50,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "value": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "label": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "aliases": {
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 200
                        }
                      }
                    },
                    "required": [
                      "value",
                      "label"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            },
            "required": [
              "schema_id",
              "query"
            ],
            "additionalProperties": false
          },
          "model_connection_id": {
            "description": "Reserved for existing clients. Rejected with BYOK_DISABLED while BYOK is disabled; omit for managed AI.",
            "type": "string",
            "minLength": 1,
            "maxLength": 140
          },
          "model_limits": {
            "type": "object",
            "properties": {
              "max_calls": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1
              },
              "max_output_tokens": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 1000000
              }
            },
            "additionalProperties": false
          },
          "outputs": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "filters",
                "labels",
                "components",
                "object",
                "workflow"
              ]
            }
          },
          "capabilities": {
            "default": [],
            "maxItems": 16,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            }
          }
        },
        "required": [
          "input",
          "capabilities"
        ],
        "additionalProperties": false
      },
      "SemanticEvaluationResponse": {
        "type": "object",
        "required": [
          "request_id",
          "status",
          "outputs",
          "bundle",
          "usage"
        ],
        "properties": {
          "request_id": {
            "type": "string"
          },
          "schema_id": {
            "type": "string"
          },
          "schema_version": {
            "type": "integer"
          },
          "status": {
            "enum": [
              "resolved",
              "partial",
              "unresolved"
            ]
          },
          "outputs": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "required": [
                "status"
              ],
              "properties": {
                "status": {
                  "enum": [
                    "ready",
                    "absent",
                    "unresolved",
                    "blocked",
                    "not_requested"
                  ]
                },
                "value": {},
                "issues": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          },
          "bundle": {
            "type": "object",
            "required": [
              "schema_id",
              "content_hash",
              "compiler_version"
            ],
            "properties": {
              "schema_id": {
                "type": "string"
              },
              "content_hash": {
                "type": "string"
              },
              "compiler_version": {
                "type": "string"
              }
            }
          },
          "accounting_state": {
            "const": "finalized"
          },
          "execution": {
            "type": "object",
            "properties": {
              "mode": {
                "const": "standard"
              },
              "performance_qualification": {
                "const": "not_measured"
              }
            }
          },
          "timing": {
            "$ref": "#/components/schemas/ExecutionTiming"
          },
          "usage": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Usage"
              },
              {
                "$ref": "#/components/schemas/RunUsage"
              }
            ]
          }
        }
      },
      "RelationBinding": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "relation": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "phrases": {
            "minItems": 1,
            "maxItems": 8,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 2,
              "maxLength": 80,
              "pattern": "^[\\p{L}][\\p{L}\\s-]+$"
            }
          },
          "capability": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "contract": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_.-]{0,80}\\/[1-9][0-9]*$"
          },
          "subject_role": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "anchor_role": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "mode": {
            "type": "string",
            "enum": [
              "native",
              "local"
            ]
          },
          "query_distance": {
            "type": "object",
            "properties": {
              "value_argument": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{0,63}$"
              },
              "unit_argument": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{0,63}$"
              },
              "units": {
                "minItems": 1,
                "maxItems": 3,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "m",
                    "km",
                    "mi"
                  ]
                }
              },
              "max": {
                "type": "number",
                "exclusiveMinimum": 0
              }
            },
            "required": [
              "value_argument",
              "unit_argument",
              "units",
              "max"
            ],
            "additionalProperties": false
          },
          "local_mapping": {
            "type": "object",
            "properties": {
              "snapshot_id": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{0,63}$"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "reviewed": {
                "type": "boolean",
                "const": true
              },
              "target_field": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{0,63}$"
              },
              "expires_at": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "entries": {
                "maxItems": 100,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "anchor": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "values": {
                      "maxItems": 50,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      }
                    }
                  },
                  "required": [
                    "anchor",
                    "values"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "snapshot_id",
              "version",
              "reviewed",
              "target_field",
              "entries"
            ],
            "additionalProperties": false
          },
          "fidelity": {
            "default": "schema_defined",
            "type": "string",
            "enum": [
              "exact",
              "schema_defined",
              "approximate"
            ]
          },
          "arguments": {
            "default": {},
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 200
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "required_arguments": {
            "default": [],
            "maxItems": 16,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            }
          }
        },
        "required": [
          "id",
          "version",
          "relation",
          "phrases",
          "capability",
          "contract",
          "subject_role",
          "anchor_role",
          "mode",
          "fidelity",
          "arguments",
          "required_arguments"
        ],
        "additionalProperties": false
      },
      "EvaluationCase": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "evaluation_mode": {
            "type": "string",
            "enum": [
              "parse",
              "semantic",
              "requirements"
            ]
          },
          "requested_outputs": {
            "minItems": 1,
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "filters",
                "labels",
                "components",
                "object",
                "workflow"
              ]
            }
          },
          "expected_requirement_result": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "resolved",
                  "partially_resolved",
                  "unresolved"
                ]
              },
              "relaxation_required": {
                "type": "boolean"
              },
              "issue_codes": {
                "default": [],
                "maxItems": 2,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "CONTRADICTORY_REQUIREMENTS",
                    "AMBIGUOUS_SCOPE"
                  ]
                }
              }
            },
            "required": [
              "status",
              "relaxation_required",
              "issue_codes"
            ],
            "additionalProperties": false
          },
          "expected_filters": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100
                },
                "operator": {
                  "type": "string",
                  "enum": [
                    "eq",
                    "neq",
                    "gt",
                    "gte",
                    "lt",
                    "lte",
                    "in",
                    "not_in",
                    "contains",
                    "between",
                    "exists"
                  ]
                },
                "value": {
                  "$ref": "#/$defs/__schema0"
                }
              },
              "required": [
                "field",
                "operator",
                "value"
              ],
              "additionalProperties": false
            }
          },
          "expected_unresolved_codes": {
            "default": [],
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          "expected_outputs": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "enum": [
                "filters",
                "labels",
                "components",
                "object",
                "workflow"
              ]
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string",
                  "enum": [
                    "ready",
                    "absent",
                    "unresolved",
                    "blocked",
                    "not_requested"
                  ]
                },
                "value": {
                  "$ref": "#/$defs/__schema1"
                },
                "completeness": {
                  "type": "string",
                  "enum": [
                    "complete",
                    "incomplete"
                  ]
                },
                "fidelity": {
                  "type": "string",
                  "enum": [
                    "exact",
                    "schema_defined",
                    "approximate"
                  ]
                },
                "execution_eligibility": {
                  "type": "string",
                  "enum": [
                    "eligible",
                    "requires_explicit_relaxation",
                    "requires_application_authorization",
                    "blocked",
                    "not_applicable"
                  ]
                }
              },
              "additionalProperties": false
            }
          },
          "capabilities": {
            "maxItems": 16,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            }
          },
          "candidates": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "aliases": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "value",
                  "label"
                ],
                "additionalProperties": false
              }
            }
          },
          "context": {
            "type": "object",
            "properties": {
              "locale": {
                "type": "string"
              },
              "timezone": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "query",
          "expected_filters",
          "expected_unresolved_codes"
        ],
        "additionalProperties": false,
        "$defs": {
          "__schema0": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/$defs/__schema0"
                }
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/$defs/__schema0"
                }
              }
            ]
          },
          "__schema1": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/$defs/__schema1"
                }
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/$defs/__schema1"
                }
              }
            ]
          }
        },
        "description": "Saved evaluation case. requirements mode requires expected_requirement_result; completeness/fidelity/eligibility assertions are v3-only. For v3 logical/relation AST assertions use expected_outputs.filters.value and an empty expected_filters list. Existing cases without evaluation_mode retain v1/v2 selection."
      },
      "MappingExpression": {
        "description": "Bounded local expression: depth <=8, nodes <=128, output <=16384 bytes. No code, network or secret access. Publication also checks dependencies, types and units.",
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "op",
              "path"
            ],
            "properties": {
              "op": {
                "const": "read"
              },
              "path": {
                "type": "string",
                "maxLength": 160,
                "pattern": "^(fields|mappings|decisions)\\.[a-z][a-z0-9_]*(\\.(value|operator))?$"
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "op",
              "value"
            ],
            "properties": {
              "op": {
                "const": "literal"
              },
              "value": {
                "oneOf": [
                  {
                    "type": "string",
                    "maxLength": 4000
                  },
                  {
                    "type": [
                      "number",
                      "boolean",
                      "null"
                    ]
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "op",
              "fields"
            ],
            "properties": {
              "op": {
                "const": "object"
              },
              "fields": {
                "type": "object",
                "maxProperties": 32,
                "propertyNames": {
                  "pattern": "^[a-z][a-z0-9_]{0,63}$",
                  "not": {
                    "enum": [
                      "constructor",
                      "prototype",
                      "__proto__"
                    ]
                  }
                },
                "additionalProperties": {
                  "$ref": "#/components/schemas/MappingExpression"
                }
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "op",
              "items"
            ],
            "properties": {
              "op": {
                "const": "array"
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MappingExpression"
                },
                "minItems": 0,
                "maxItems": 64
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "op",
              "input",
              "path"
            ],
            "properties": {
              "op": {
                "const": "path"
              },
              "input": {
                "$ref": "#/components/schemas/MappingExpression"
              },
              "path": {
                "type": "array",
                "minItems": 1,
                "maxItems": 6,
                "items": {
                  "oneOf": [
                    {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "not": {
                        "enum": [
                          "constructor",
                          "prototype",
                          "__proto__"
                        ]
                      }
                    },
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 63
                    }
                  ]
                }
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "op",
              "inputs"
            ],
            "properties": {
              "op": {
                "const": "coalesce"
              },
              "inputs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MappingExpression"
                },
                "minItems": 1,
                "maxItems": 16
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "op",
              "condition",
              "then",
              "else"
            ],
            "properties": {
              "op": {
                "const": "select"
              },
              "condition": {
                "$ref": "#/components/schemas/MappingExpression"
              },
              "then": {
                "$ref": "#/components/schemas/MappingExpression"
              },
              "else": {
                "$ref": "#/components/schemas/MappingExpression"
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "op",
              "comparison",
              "left",
              "right"
            ],
            "properties": {
              "op": {
                "const": "compare"
              },
              "comparison": {
                "enum": [
                  "eq",
                  "neq",
                  "lt",
                  "lte",
                  "gt",
                  "gte"
                ]
              },
              "left": {
                "$ref": "#/components/schemas/MappingExpression"
              },
              "right": {
                "$ref": "#/components/schemas/MappingExpression"
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "op",
              "template",
              "inputs",
              "max_length"
            ],
            "properties": {
              "op": {
                "const": "format"
              },
              "template": {
                "type": "string",
                "maxLength": 4000
              },
              "inputs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MappingExpression"
                },
                "minItems": 0,
                "maxItems": 16
              },
              "max_length": {
                "type": "integer",
                "minimum": 1,
                "maximum": 4000
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "op",
              "operation",
              "left",
              "right",
              "unit",
              "precision"
            ],
            "properties": {
              "op": {
                "const": "arithmetic"
              },
              "operation": {
                "enum": [
                  "add",
                  "subtract",
                  "multiply",
                  "divide"
                ]
              },
              "left": {
                "$ref": "#/components/schemas/MappingExpression"
              },
              "right": {
                "$ref": "#/components/schemas/MappingExpression"
              },
              "unit": {
                "type": "string",
                "pattern": "^[a-zA-Z][a-zA-Z0-9_ /.-]{0,31}$"
              },
              "precision": {
                "type": "integer",
                "minimum": 0,
                "maximum": 6
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "op",
              "input",
              "from",
              "to",
              "precision"
            ],
            "properties": {
              "op": {
                "const": "convert"
              },
              "input": {
                "$ref": "#/components/schemas/MappingExpression"
              },
              "from": {
                "type": "string",
                "pattern": "^[a-zA-Z][a-zA-Z0-9_ /.-]{0,31}$"
              },
              "to": {
                "type": "string",
                "pattern": "^[a-zA-Z][a-zA-Z0-9_ /.-]{0,31}$"
              },
              "precision": {
                "type": "integer",
                "minimum": 0,
                "maximum": 6
              }
            }
          }
        ]
      },
      "ValueContract": {
        "description": "Maximum depth 6 and 128 contract nodes. Numeric bounds/precision and output bytes are checked at runtime. Conversions allow km/m, sqft/sqm, kg/g and hour/minute only.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "enum": [
              "string",
              "number",
              "integer",
              "boolean",
              "array",
              "object"
            ]
          },
          "unit": {
            "type": "string",
            "pattern": "^[a-zA-Z][a-zA-Z0-9_ /.-]{0,31}$"
          },
          "precision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 6
          },
          "min": {
            "type": "number"
          },
          "max": {
            "type": "number"
          },
          "max_length": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4000
          },
          "max_items": {
            "type": "integer",
            "minimum": 0,
            "maximum": 64
          },
          "items": {
            "$ref": "#/components/schemas/ValueContract"
          },
          "properties": {
            "type": "object",
            "maxProperties": 32,
            "propertyNames": {
              "pattern": "^[a-z][a-z0-9_]{0,63}$",
              "not": {
                "enum": [
                  "constructor",
                  "prototype",
                  "__proto__"
                ]
              }
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/ValueContract"
            }
          },
          "required": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "type": {
                  "const": "string"
                }
              }
            },
            "then": {
              "required": [
                "max_length"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "type": {
                  "const": "array"
                }
              }
            },
            "then": {
              "required": [
                "items",
                "max_items"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "type": {
                  "const": "object"
                }
              }
            },
            "then": {
              "required": [
                "properties",
                "required"
              ]
            }
          }
        ]
      },
      "ExecutionTiming": {
        "type": "object",
        "required": [
          "total_ms",
          "scope",
          "stages_ms"
        ],
        "properties": {
          "total_ms": {
            "type": "number",
            "minimum": 0
          },
          "scope": {
            "const": "through_output_assembly"
          },
          "stages_ms": {
            "type": "object",
            "additionalProperties": {
              "type": "number",
              "minimum": 0
            }
          },
          "native": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "questions": {
                "type": "integer"
              },
              "criteria": {
                "type": "integer"
              },
              "payload_bytes": {
                "type": "integer"
              },
              "activation": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "omitted": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            }
          }
        },
        "description": "Stored response stops before durable settlement. The Server-Timing response header includes settlement and middleware total for the current attempt. Neither is a production SLA."
      },
      "FlowDefinition": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "default": "",
            "type": "string",
            "maxLength": 1000
          },
          "profile": {
            "default": "standard",
            "type": "string",
            "const": "standard"
          },
          "context_contract": {
            "$ref": "#/components/schemas/ValueContract"
          },
          "deadline_ms": {
            "default": 30000,
            "type": "integer",
            "minimum": 1000,
            "maximum": 30000
          },
          "steps": {
            "minItems": 1,
            "maxItems": 12,
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,47}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "depends_on": {
                      "default": [],
                      "maxItems": 12,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,47}$"
                      }
                    },
                    "when": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,47}$"
                    },
                    "kind": {
                      "type": "string",
                      "const": "evaluate"
                    },
                    "schema_id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 140
                    },
                    "result_path": {
                      "minItems": 1,
                      "maxItems": 8,
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9_]*$"
                          },
                          {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 63
                          }
                        ]
                      }
                    },
                    "result_contract": {
                      "$ref": "#/components/schemas/ValueContract"
                    },
                    "query": {
                      "$ref": "#/components/schemas/MappingExpression"
                    },
                    "context": {
                      "$ref": "#/components/schemas/MappingExpression"
                    },
                    "outputs": {
                      "maxItems": 5,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "filters",
                          "labels",
                          "components",
                          "object",
                          "workflow"
                        ]
                      }
                    },
                    "capabilities": {
                      "default": [],
                      "maxItems": 16,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,47}$"
                      }
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "depends_on",
                    "kind",
                    "schema_id",
                    "result_path",
                    "result_contract",
                    "query",
                    "capabilities"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,47}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "depends_on": {
                      "default": [],
                      "maxItems": 12,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,47}$"
                      }
                    },
                    "when": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,47}$"
                    },
                    "kind": {
                      "type": "string",
                      "const": "transform"
                    },
                    "expression": {
                      "$ref": "#/components/schemas/MappingExpression"
                    },
                    "contract": {
                      "$ref": "#/components/schemas/ValueContract"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "depends_on",
                    "kind",
                    "expression",
                    "contract"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,47}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "depends_on": {
                      "default": [],
                      "maxItems": 12,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,47}$"
                      }
                    },
                    "when": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,47}$"
                    },
                    "kind": {
                      "type": "string",
                      "const": "condition"
                    },
                    "expression": {
                      "$ref": "#/components/schemas/MappingExpression"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "depends_on",
                    "kind",
                    "expression"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,47}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "depends_on": {
                      "default": [],
                      "maxItems": 12,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,47}$"
                      }
                    },
                    "when": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,47}$"
                    },
                    "kind": {
                      "type": "string",
                      "const": "output"
                    },
                    "expression": {
                      "$ref": "#/components/schemas/MappingExpression"
                    },
                    "contract": {
                      "$ref": "#/components/schemas/ValueContract"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "depends_on",
                    "kind",
                    "expression",
                    "contract"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,47}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "depends_on": {
                      "default": [],
                      "maxItems": 12,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,47}$"
                      }
                    },
                    "when": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,47}$"
                    },
                    "kind": {
                      "type": "string",
                      "const": "handoff"
                    },
                    "expression": {
                      "$ref": "#/components/schemas/MappingExpression"
                    },
                    "contract": {
                      "$ref": "#/components/schemas/ValueContract"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "depends_on",
                    "kind",
                    "expression",
                    "contract"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,47}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "depends_on": {
                      "default": [],
                      "maxItems": 12,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,47}$"
                      }
                    },
                    "when": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,47}$"
                    },
                    "kind": {
                      "type": "string",
                      "const": "external_read"
                    },
                    "resolver_id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 140
                    },
                    "result_contract": {
                      "$ref": "#/components/schemas/ValueContract"
                    },
                    "input": {
                      "$ref": "#/components/schemas/MappingExpression"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "depends_on",
                    "kind",
                    "resolver_id",
                    "result_contract",
                    "input"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          }
        },
        "required": [
          "name",
          "description",
          "profile",
          "context_contract",
          "deadline_ms",
          "steps"
        ],
        "additionalProperties": false
      },
      "WorkflowJobRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "source_request_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "action": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "authorization": {
            "type": "object",
            "properties": {
              "decision_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 160
              },
              "subject": {
                "type": "string",
                "minLength": 1,
                "maxLength": 160
              },
              "resource": {
                "type": "string",
                "minLength": 1,
                "maxLength": 240
              },
              "confirmed": {
                "type": "boolean",
                "const": true
              }
            },
            "required": [
              "decision_id",
              "subject",
              "resource",
              "confirmed"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "source_request_id",
          "action",
          "version",
          "authorization"
        ],
        "additionalProperties": false
      },
      "WorkflowJob": {
        "type": "object",
        "required": [
          "id",
          "state",
          "checkpoint",
          "execution",
          "accounting"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "awaiting_input",
              "succeeded",
              "failed",
              "canceled",
              "unknown"
            ]
          },
          "checkpoint": {
            "type": "object"
          },
          "execution": {
            "const": "managed"
          },
          "accounting": {
            "type": "object"
          },
          "reconciliation_required": {
            "type": "boolean"
          }
        }
      },
      "FlowRunRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "flow_version_id",
          "query"
        ],
        "properties": {
          "flow_version_id": {
            "type": "string"
          },
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "context": {
            "type": "object",
            "default": {}
          }
        }
      },
      "FlowRun": {
        "type": "object",
        "required": [
          "contract",
          "id",
          "state",
          "steps",
          "accounting"
        ],
        "properties": {
          "contract": {
            "const": "queryfill.flow/1"
          },
          "id": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "checkpointed",
              "awaiting_input",
              "succeeded",
              "failed",
              "canceled"
            ]
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "step_id": {
                  "type": "string"
                },
                "state": {
                  "type": "string"
                },
                "value": {},
                "source_request_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "error_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "can_resume": {
            "type": "boolean",
            "description": "Whether the current snapshot can be resumed. Refresh after an active lease expires."
          },
          "resume_available_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "accounting": {
            "type": "object"
          },
          "automatic_actions": {
            "const": false
          }
        }
      }
    }
  }
}
