{
  "schema": "seam.compiler-contract.v1",
  "version": "0.13.0",
  "authority": "deterministic-seam-compiler",
  "aiRequired": false,
  "stages": {
    "convert": {
      "command": "/convert /bricks",
      "input": "arbitrary HTML/CSS/JS project or standalone document",
      "output": "raw native Bricks 2.3.10 templates",
      "frameworkNeutral": true,
      "maySplitDocumentChrome": true,
      "ownership": "Bricks element-native controls plus scoped unsupported CSS"
    },
    "framework": {
      "command": "/seamframework",
      "commands": ["/seamframework", "/convert /bricks /seamframework"],
      "input": "rendered raw HTML/CSS/JS evidence in one-pass mode, or a successful raw Bricks conversion result retained in the same compiler session",
      "output": "one Framework Profile, profile-dependent Bricks templates, and executable /audit /seamframework proof",
      "optional": true,
      "onePassMode": true,
      "rawEvidenceCapturedBeforeFrameworkOwnership": true,
      "packageManifestDeclaresInstallOrder": true,
      "profileInstallRequiredBeforeTemplateImport": true,
      "ownershipOrder": [
        "Bricks Theme Style for body, headings, links and site background",
        "universal Kiwe and Seam variables and palette",
        "project variables and reusable project classes",
        "element-native settings for genuine exceptions",
        "scoped CSS only for unsupported behavior"
      ]
    },
    "accessibility": {
      "command": "/accessibility",
      "commands": ["/accessibility", "/create /accessibility", "/audit /accessibility", "/fix /accessibility"],
      "input": "successful raw or Framework-enhanced conversion result",
      "output": "SEAM automated accessibility score with manual checks separated, a measured plan, and either an independent raw Bricks light/dark palette or coordinated Framework values",
      "optional": true,
      "phase": "separate",
      "currentCompletionGate": true,
      "requiresExecutableProof": true,
      "browserAiMayNotInventContrastRatios": true,
      "bricksDarkModeBinding": ":root[data-brx-theme=\"dark\"] #brxe-<template-root-id>",
      "scopeRule": "Enhanced templates bind coordinated values at their own root so source-scoped variables cannot shadow Bricks native dark mode."
    },
    "audit": {
      "commands": ["/audit /bricksconversion", "/audit /seamframework"],
      "requiresExecutableProof": true,
      "visualProofRequiresMatchingViewportProvenance": true,
      "sourceDefectsAreNotConverterDefects": true,
      "invalidOrContaminatedCaptureStatus": "INCOMPLETE"
    }
  },
  "invariants": [
    "Raw Convert never injects or requires Seam Framework.",
    "Framework is an optional conversion mode and ownership stage, not a redesign; its one-pass path consumes the full raw evidence before serialization can discard compiler-only context.",
    "Framework completion requires a 100% package-integration PASS; visual parity remains the separate raw-conversion proof.",
    "A missing Framework Profile must fail closed; templates must not depend on CSS variable fallbacks.",
    "Browser AI may create or refine the source design but must not author production Bricks JSON or Framework Profile data.",
    "If the hosted compiler is unavailable, browser AI must invoke the official local compiler/runtime or Kiwe REST validation bridge; without executable authority the lane is WARN/UNVERIFIED, never PASS.",
    "Accessibility is a separate deterministic stage: it preserves the approved design, measures real token pairs, coordinates Kiwe and Bricks light/dark values, and never invents generic contrast evidence.",
    "No project-specific selector or route-name rule may enter the compiler core."
  ]
}
