{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/darwin-so/json-schema/darwin-so-search-response-schema.json",
  "title": "SearchResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/darwin-so-search-api-openapi.yml#/components/schemas/SearchResponse",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "contractVersion",
    "outcome",
    "results",
    "agents",
    "versions"
  ],
  "properties": {
    "contractVersion": {
      "type": "string",
      "enum": [
        "search-public-v2"
      ]
    },
    "outcome": {
      "type": "string",
      "enum": [
        "MATCH",
        "CLARIFY",
        "NO_ELIGIBLE_SUPPLY"
      ]
    },
    "results": {
      "type": "array",
      "maxItems": 50,
      "items": {
        "$ref": "#/$defs/SearchOrderedCapability"
      }
    },
    "agents": {
      "type": "array",
      "maxItems": 50,
      "items": {
        "$ref": "#/$defs/SearchAgent"
      }
    },
    "versions": {
      "$ref": "#/$defs/SearchVersions"
    },
    "diagnostics": {
      "type": "object",
      "description": "Present only for a server-configured read-only evaluation service account; ordinary clients cannot request it.",
      "additionalProperties": false,
      "required": [
        "stopReason",
        "intent",
        "candidates"
      ],
      "properties": {
        "stopReason": {
          "type": "string"
        },
        "intent": {},
        "candidates": {
          "type": "array",
          "maxItems": 100,
          "items": {
            "type": "object"
          }
        }
      }
    }
  },
  "$defs": {
    "SearchActCapability": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "capability",
        "revision",
        "name",
        "description",
        "category",
        "readiness",
        "canStartThread",
        "input"
      ],
      "properties": {
        "capability": {
          "type": "string",
          "description": "Pass this exact ID as action_request messageContent.capability."
        },
        "revision": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "category": {
          "type": [
            "string",
            "null"
          ]
        },
        "readiness": {
          "type": "string",
          "enum": [
            "ready",
            "authentication_required",
            "recheck_available",
            "unavailable"
          ]
        },
        "canStartThread": {
          "type": "boolean"
        },
        "canAttemptThread": {
          "type": "boolean"
        },
        "threadUnavailableReason": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "ACT_THREAD_CUTOVER_PENDING",
            "TARGET_CAPABILITY_NOT_FOUND",
            "THREAD_CAPABILITY_CATALOG_TOO_LARGE",
            "ROUTE_NOT_CONFIGURED",
            "ROUTE_REVISION_STALE",
            "ROUTE_NOT_APPROVED",
            "ROUTE_NOT_READY",
            "ROUTE_NOT_VERIFIED",
            "ROUTE_VERIFICATION_EXPIRED",
            "CALLABLE_TRANSPORT_NOT_VERIFIED",
            "THREAD_ADAPTER_UNAVAILABLE",
            "CAPABILITY_SCHEMA_MISSING",
            "THREAD_AUTH_BINDING_UNVERIFIED",
            "THREAD_DISCOVERY_AUTHENTICATION_REQUIRED",
            "EXECUTION_METADATA_PENDING",
            "THREAD_READINESS_UNAVAILABLE",
            null
          ]
        },
        "input": {
          "$ref": "#/$defs/SearchCapabilityInput"
        }
      }
    },
    "SearchAgent": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "agent",
        "name",
        "description",
        "category",
        "handle",
        "avatar",
        "verified",
        "readiness",
        "canStartThread",
        "capabilities"
      ],
      "properties": {
        "agent": {
          "type": "string",
          "description": "Pass this exact ID as start_thread.targetAgent."
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "category": {
          "type": [
            "string",
            "null"
          ]
        },
        "handle": {
          "type": [
            "string",
            "null"
          ]
        },
        "avatar": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "verified": {
          "type": "boolean"
        },
        "readiness": {
          "type": "string",
          "enum": [
            "ready",
            "authentication_required",
            "recheck_available",
            "unavailable"
          ]
        },
        "canStartThread": {
          "type": "boolean"
        },
        "canAttemptThread": {
          "type": "boolean"
        },
        "capabilities": {
          "type": "array",
          "minItems": 1,
          "maxItems": 50,
          "items": {
            "$ref": "#/$defs/SearchActCapability"
          }
        }
      }
    },
    "SearchCapabilityInput": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "available",
        "additionalFieldsAllowed",
        "fields"
      ],
      "properties": {
        "available": {
          "type": "boolean"
        },
        "additionalFieldsAllowed": {
          "type": "boolean",
          "enum": [
            false
          ]
        },
        "fields": {
          "type": "array",
          "maxItems": 32,
          "items": {
            "$ref": "#/$defs/SearchCapabilityInputField"
          }
        }
      }
    },
    "SearchCapabilityInputField": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "valueType",
        "description",
        "required",
        "allowedValues",
        "format",
        "minLength",
        "maxLength",
        "minimum",
        "maximum",
        "minItems",
        "maxItems"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "valueType": {
          "type": "string",
          "description": "JSON fields require X-Darwin-Input-Contract-Version: 2. Omitted or unsupported profiles retain the legacy field projection; this header grants no execution authority.",
          "enum": [
            "string",
            "number",
            "integer",
            "boolean",
            "string_list",
            "number_list",
            "integer_list",
            "boolean_list",
            "json"
          ]
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "required": {
          "type": "boolean"
        },
        "allowedValues": {
          "type": "array",
          "maxItems": 50,
          "items": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          }
        },
        "format": {
          "type": [
            "string",
            "null"
          ]
        },
        "minLength": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "maxLength": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "minimum": {
          "type": [
            "number",
            "null"
          ]
        },
        "maximum": {
          "type": [
            "number",
            "null"
          ]
        },
        "minItems": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "maxItems": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        }
      }
    },
    "SearchOrderedCapability": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "rank",
        "agent",
        "capability",
        "revision",
        "name",
        "description",
        "category",
        "readiness",
        "canStartThread",
        "input"
      ],
      "properties": {
        "rank": {
          "type": "integer",
          "minimum": 1,
          "maximum": 50
        },
        "agent": {
          "type": "string"
        },
        "capability": {
          "type": "string"
        },
        "revision": {
          "type": "integer",
          "minimum": 1
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "category": {
          "type": [
            "string",
            "null"
          ]
        },
        "readiness": {
          "type": "string",
          "enum": [
            "ready",
            "authentication_required",
            "recheck_available",
            "unavailable"
          ]
        },
        "canStartThread": {
          "type": "boolean"
        },
        "canAttemptThread": {
          "type": "boolean"
        },
        "threadUnavailableReason": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "ACT_THREAD_CUTOVER_PENDING",
            "TARGET_CAPABILITY_NOT_FOUND",
            "THREAD_CAPABILITY_CATALOG_TOO_LARGE",
            "ROUTE_NOT_CONFIGURED",
            "ROUTE_REVISION_STALE",
            "ROUTE_NOT_APPROVED",
            "ROUTE_NOT_READY",
            "ROUTE_NOT_VERIFIED",
            "ROUTE_VERIFICATION_EXPIRED",
            "CALLABLE_TRANSPORT_NOT_VERIFIED",
            "THREAD_ADAPTER_UNAVAILABLE",
            "CAPABILITY_SCHEMA_MISSING",
            "THREAD_AUTH_BINDING_UNVERIFIED",
            "THREAD_DISCOVERY_AUTHENTICATION_REQUIRED",
            "EXECUTION_METADATA_PENDING",
            "THREAD_READINESS_UNAVAILABLE",
            null
          ]
        },
        "input": {
          "$ref": "#/$defs/SearchCapabilityInput"
        }
      }
    },
    "SearchVersions": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "generation",
        "projection",
        "embedding",
        "sparse",
        "retrieval",
        "feature",
        "ranker",
        "policy"
      ],
      "properties": {
        "generation": {
          "type": [
            "string",
            "null"
          ]
        },
        "projection": {
          "type": [
            "string",
            "null"
          ]
        },
        "embedding": {
          "type": [
            "string",
            "null"
          ]
        },
        "sparse": {
          "type": [
            "string",
            "null"
          ]
        },
        "retrieval": {
          "type": [
            "string",
            "null"
          ]
        },
        "feature": {
          "type": [
            "string",
            "null"
          ]
        },
        "ranker": {
          "type": [
            "string",
            "null"
          ]
        },
        "policy": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}