{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "gno://schemas/retrieval-trace-summary@1.0",
  "title": "GNO Retrieval Trace Summary",
  "definitions": {
    "sha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "textShape": {
      "type": "object",
      "additionalProperties": false,
      "required": ["characters", "terms"],
      "properties": {
        "characters": { "type": "integer", "minimum": 0 },
        "terms": { "type": "integer", "minimum": 0 }
      }
    },
    "fingerprints": {
      "type": "object",
      "additionalProperties": false,
      "required": ["pipeline", "model", "config", "index"],
      "properties": {
        "pipeline": { "$ref": "#/definitions/sha256" },
        "model": { "$ref": "#/definitions/sha256" },
        "config": { "$ref": "#/definitions/sha256" },
        "index": { "$ref": "#/definitions/sha256" }
      }
    },
    "egressLineage": {
      "$ref": "gno://schemas/retrieval-trace-common@1.0#/definitions/egressLineage"
    }
  },
  "type": "object",
  "additionalProperties": false,
  "required": [
    "traceId",
    "schemaVersion",
    "redactionMode",
    "replayCapable",
    "status",
    "queryShape",
    "goalShape",
    "fingerprints",
    "createdAtMs",
    "updatedAtMs",
    "expiresAtMs",
    "byteSize",
    "creationDigest"
  ],
  "properties": {
    "traceId": { "type": "string", "minLength": 1, "maxLength": 128 },
    "schemaVersion": { "const": "1.0" },
    "redactionMode": { "enum": ["metadata", "replay"] },
    "replayCapable": { "type": "boolean" },
    "status": {
      "enum": ["open", "completed", "partial", "failed", "cancelled"]
    },
    "queryShape": { "$ref": "#/definitions/textShape" },
    "goalShape": { "$ref": "#/definitions/textShape" },
    "egressLineage": { "$ref": "#/definitions/egressLineage" },
    "fingerprints": { "$ref": "#/definitions/fingerprints" },
    "createdAtMs": { "type": "integer", "minimum": 0 },
    "updatedAtMs": { "type": "integer", "minimum": 0 },
    "expiresAtMs": { "type": "integer", "minimum": 0 },
    "byteSize": { "type": "integer", "minimum": 0 },
    "creationDigest": { "$ref": "#/definitions/sha256" }
  }
}
