{
  "$defs": {
    "BundleObject": {
      "additionalProperties": false,
      "description": "A verified object after the server-side copy into the bundles bucket.",
      "properties": {
        "bucket": {
          "maxLength": 63,
          "title": "Bucket",
          "type": "string"
        },
        "content_type": {
          "anyOf": [
            {
              "maxLength": 256,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Content Type"
        },
        "crc32c": {
          "description": "CRC32C as GCS reports it: base64 of the big-endian 4-byte checksum",
          "examples": [
            "4waSgw=="
          ],
          "pattern": "^[A-Za-z0-9+/]{6}==$",
          "title": "Crc32C",
          "type": "string"
        },
        "generation": {
          "minimum": 1,
          "title": "Generation",
          "type": "integer"
        },
        "key": {
          "maxLength": 1024,
          "minLength": 1,
          "title": "Key",
          "type": "string"
        },
        "md5": {
          "description": "MD5 as GCS reports it: base64 of the 16-byte digest",
          "pattern": "^[A-Za-z0-9+/]{22}==$",
          "title": "Md5",
          "type": "string"
        },
        "size": {
          "minimum": 0,
          "title": "Size",
          "type": "integer"
        }
      },
      "required": [
        "bucket",
        "key",
        "generation",
        "size",
        "crc32c",
        "md5"
      ],
      "title": "BundleObject",
      "type": "object"
    },
    "ManifestSignature": {
      "additionalProperties": false,
      "description": "Platform signature over :func:`bundle_manifest_signing_bytes`.\n\n``HS256`` (HMAC-SHA256 with a server-held key) is the local/M1 signer; KMS asymmetric\nsigners (M2) use their own ``alg`` and the same signing bytes.",
      "properties": {
        "alg": {
          "enum": [
            "HS256",
            "KMS-EC-P256-SHA256",
            "KMS-RSA-PSS-SHA256"
          ],
          "title": "Alg",
          "type": "string"
        },
        "key_id": {
          "maxLength": 256,
          "minLength": 1,
          "title": "Key Id",
          "type": "string"
        },
        "value": {
          "maxLength": 2048,
          "minLength": 1,
          "title": "Value",
          "type": "string"
        }
      },
      "required": [
        "alg",
        "key_id",
        "value"
      ],
      "title": "ManifestSignature",
      "type": "object"
    },
    "RunKind": {
      "description": "What a run does. ``validate`` is the explicit sandboxed dry-run of a spec.\n\n``sweep``, ``backtest``, ``sbc`` and ``campaign`` are fan-out *parents* (plan \u00a76.2,\nM4): they own child runs and never execute on an executor themselves.",
      "enum": [
        "ingest",
        "describe",
        "validate",
        "fit",
        "score",
        "evaluate",
        "derive",
        "render",
        "optimize",
        "sweep",
        "backtest",
        "sbc",
        "campaign",
        "translate_priors",
        "workflow",
        "workflow_node",
        "explore",
        "governance",
        "inspect"
      ],
      "title": "RunKind",
      "type": "string"
    }
  },
  "$id": "https://schemas.mapi.dev/v1/bundlemanifest.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "The platform-signed manifest of a bundle (``manifest.json`` + ``manifest.sig``).\n\nBinds tenant, run, base digest, overlay hash, spec hash, data hash and every\n*destination* generation. URLs to a bundle are minted only after this signature checks.",
  "examples": [
    {
      "attempt": 1,
      "base_image": "base-bayes@2026.10",
      "catalog_digest": "sha256:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd",
      "data_hash": "sha256:efefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefef",
      "kind": "fit",
      "model_id": "mdl_01jabcdefghjkmnpqrstvwxyz0",
      "model_version": 1,
      "objects": {
        "bundle.zarr.zip": {
          "bucket": "mapi-local-bundles",
          "content_type": "application/zip",
          "crc32c": "AAAAAA==",
          "generation": 1760520000000001,
          "key": "t/default/models/mdl_01jabcdefghjkmnpqrstvwxyz0/1/bundle.zarr.zip",
          "md5": "1B2M2Y8AsgTpgAmY7PhCfg==",
          "size": 2097152
        }
      },
      "project_id": "default",
      "run_id": "run_01jabcdefghjkmnpqrstvwxyz0",
      "schema_version": "mapi.bundle-manifest/v1",
      "signature": {
        "alg": "HS256",
        "key_id": "local-1",
        "value": "0000000000000000000000000000000000000000000000000000000000000000"
      },
      "signed_at": "2026-10-15T10:21:00Z",
      "source_manifest_crc32c": "4waSgw==",
      "spec_hash": "sha256:abababababababababababababababababababababababababababababababab",
      "status": "complete",
      "tenant_id": "default"
    }
  ],
  "properties": {
    "attempt": {
      "minimum": 1,
      "title": "Attempt",
      "type": "integer"
    },
    "base_image": {
      "anyOf": [
        {
          "maxLength": 256,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Base Image"
    },
    "catalog_digest": {
      "pattern": "^sha256:[0-9a-f]{64}$",
      "title": "Catalog Digest",
      "type": "string"
    },
    "data_hash": {
      "anyOf": [
        {
          "pattern": "^sha256:[0-9a-f]{64}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Data Hash"
    },
    "kind": {
      "$ref": "#/$defs/RunKind"
    },
    "model_id": {
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_.\\-]{0,127}$",
      "title": "Model Id",
      "type": "string"
    },
    "model_version": {
      "minimum": 1,
      "title": "Model Version",
      "type": "integer"
    },
    "objects": {
      "additionalProperties": {
        "$ref": "#/$defs/BundleObject"
      },
      "maxProperties": 10000,
      "title": "Objects",
      "type": "object"
    },
    "overlay_hash": {
      "anyOf": [
        {
          "pattern": "^sha256:[0-9a-f]{64}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Overlay Hash"
    },
    "project_id": {
      "examples": [
        "default"
      ],
      "pattern": "^[a-z0-9](?:[a-z0-9_-]{0,62}[a-z0-9])?$",
      "title": "Project Id",
      "type": "string"
    },
    "run_id": {
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_.\\-]{0,127}$",
      "title": "Run Id",
      "type": "string"
    },
    "schema_version": {
      "const": "mapi.bundle-manifest/v1",
      "default": "mapi.bundle-manifest/v1",
      "title": "Schema Version",
      "type": "string"
    },
    "signature": {
      "anyOf": [
        {
          "$ref": "#/$defs/ManifestSignature"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "signed_at": {
      "format": "date-time",
      "title": "Signed At",
      "type": "string"
    },
    "source_manifest_crc32c": {
      "description": "CRC32C as GCS reports it: base64 of the big-endian 4-byte checksum",
      "examples": [
        "4waSgw=="
      ],
      "pattern": "^[A-Za-z0-9+/]{6}==$",
      "title": "Source Manifest Crc32C",
      "type": "string"
    },
    "spec_hash": {
      "pattern": "^sha256:[0-9a-f]{64}$",
      "title": "Spec Hash",
      "type": "string"
    },
    "status": {
      "enum": [
        "complete",
        "partial"
      ],
      "title": "Status",
      "type": "string"
    },
    "tenant_id": {
      "examples": [
        "default"
      ],
      "pattern": "^[a-z0-9](?:[a-z0-9_-]{0,62}[a-z0-9])?$",
      "title": "Tenant Id",
      "type": "string"
    }
  },
  "required": [
    "tenant_id",
    "project_id",
    "model_id",
    "model_version",
    "run_id",
    "attempt",
    "kind",
    "status",
    "spec_hash",
    "catalog_digest",
    "source_manifest_crc32c",
    "signed_at"
  ],
  "title": "BundleManifest",
  "type": "object",
  "x-mapi-contract-version": "0.2"
}
