{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://proofnib.com/tool-schema.json",
  "title": "ProofNib local comparison input format",
  "description": "A JSON format definition for the browser-local working preview. This is not an HTTP API or a network tool. ProofnibCore.review(contract, packet) compares declarations only; it never opens or hashes files, executes code, verifies genuine tests, proves completeness, or certifies a release. JSON inputs in the interface are limited to 100,000 characters each, record lists to 500 entries, total checked evidence references to 1,000, and retained findings to 1,200; incomplete checks are reported. The browser interface additionally bounds JSON structure to 64 nesting levels and 20,000 values per input before comparison.",
  "type": "object",
  "required": [
    "contract",
    "packet"
  ],
  "properties": {
    "contract": {
      "type": "object",
      "required": [
        "task_id",
        "input_revision",
        "required_deliverables"
      ],
      "properties": {
        "task_id": {
          "type": "string",
          "minLength": 1
        },
        "input_revision": {
          "type": "string",
          "minLength": 1
        },
        "required_deliverables": {
          "type": "array",
          "minItems": 1,
          "maxItems": 500,
          "description": "IDs must be unique. Only this declared scope is reconciled.",
          "items": {
            "type": "object",
            "required": [
              "id",
              "kind"
            ],
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "kind": {
                "type": "string",
                "minLength": 1
              },
              "expected_sha256": {
                "$ref": "#/$defs/hash"
              }
            }
          }
        }
      }
    },
    "packet": {
      "type": "object",
      "required": [
        "task_id",
        "input_revision",
        "artifacts"
      ],
      "properties": {
        "task_id": {
          "type": "string",
          "minLength": 1
        },
        "input_revision": {
          "type": "string",
          "minLength": 1
        },
        "artifacts": {
          "type": "array",
          "maxItems": 500,
          "items": {
            "type": "object",
            "required": [
              "id",
              "kind",
              "status",
              "sha256"
            ],
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "kind": {
                "type": "string",
                "minLength": 1
              },
              "status": {
                "enum": [
                  "complete",
                  "incomplete",
                  "failed"
                ]
              },
              "sha256": {
                "$ref": "#/$defs/hash"
              },
              "task_id": {
                "type": "string",
                "minLength": 1
              },
              "input_revision": {
                "type": "string",
                "minLength": 1
              },
              "evidence_refs": {
                "type": "array",
                "maxItems": 500,
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "description": "IDs of packet.evidence records; no references are fetched. Resolution does not verify evidence contents."
              }
            }
          }
        },
        "evidence": {
          "type": "array",
          "maxItems": 500,
          "items": {
            "type": "object",
            "required": [
              "id",
              "kind",
              "sha256"
            ],
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "kind": {
                "type": "string",
                "minLength": 1
              },
              "sha256": {
                "$ref": "#/$defs/hash"
              },
              "task_id": {
                "type": "string",
                "minLength": 1
              },
              "input_revision": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      }
    }
  },
  "$defs": {
    "hash": {
      "type": "string",
      "pattern": "^[a-fA-F0-9]{64}$",
      "description": "A declared SHA-256 string reference. No referenced file is opened or hashed by the preview."
    }
  }
}
