{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://law.arxo.io/schema/editor-source-map.schema.json",
  "title": "Arxo Law pinned dependency editor source map 0.1",
  "description": "Editor-only sidecar. law.lock pins its raw bytes through packages[].editorSourceMapHash; package repeats the exact locked CLIR identity. It never changes CLIR or the semantic envelope.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "package",
    "files",
    "declarations"
  ],
  "properties": {
    "schema": {
      "const": "law.editor-source-map/0.1"
    },
    "package": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "version",
        "namespace",
        "contentHash"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "version": {
          "type": "string",
          "minLength": 1
        },
        "namespace": {
          "type": "string",
          "minLength": 1
        },
        "contentHash": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{64}$"
        }
      }
    },
    "files": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "uri",
          "sha256"
        ],
        "properties": {
          "uri": {
            "type": "string",
            "pattern": "^/[^\\u0000]*$",
            "description": "Original absolute authored path; resolver may replace it only with the hash-checked installed file named by installPath."
          },
          "sha256": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "installPath": {
            "type": "string",
            "pattern": "^sources/[a-z][a-z0-9_]*(?:\\.[a-z][a-z0-9_]*)*/(?:[A-Za-z0-9][A-Za-z0-9._-]*/)*[A-Za-z0-9][A-Za-z0-9._-]*\\.law$",
            "description": "Optional safe path relative to deps/. install fetches sha256 into this path; resolver uses it only when its bytes match sha256."
          }
        }
      }
    },
    "declarations": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "stableId",
          "declarationSpan"
        ],
        "properties": {
          "stableId": {
            "type": "string",
            "minLength": 1
          },
          "declarationSpan": {
            "$ref": "editor-index.schema.json#/$defs/Span"
          }
        }
      }
    }
  }
}
