{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oods-foundry.com/schemas/pipeline.output.json",
  "title": "pipeline_run output",
  "description": "Aggregated pipeline response with partial results and explicit failure step metadata.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "compose",
    "pipeline",
    "validationReceipt"
  ],
  "allOf": [
    {
      "if": {
        "required": [
          "code"
        ]
      },
      "then": {
        "properties": {
          "validationReceipt": {
            "allOf": [
              {
                "$ref": "#/$defs/buildChecksCompleted"
              },
              {
                "if": {
                  "properties": {
                    "profile": {
                      "type": "string",
                      "const": "release"
                    }
                  },
                  "required": [
                    "profile"
                  ]
                },
                "then": {
                  "$ref": "#/$defs/releaseSuccessReceipt"
                }
              }
            ]
          }
        }
      }
    }
  ],
  "properties": {
    "payload": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "mode",
        "directory",
        "bytes",
        "files",
        "reason"
      ],
      "description": "The rendered page and the generated files, written to disk instead of returned (payloadMode).",
      "properties": {
        "mode": {
          "type": "string",
          "const": "file"
        },
        "directory": {
          "type": "string"
        },
        "bytes": {
          "type": "integer",
          "minimum": 0
        },
        "files": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "path",
              "bytes",
              "sha256"
            ],
            "properties": {
              "path": {
                "type": "string"
              },
              "bytes": {
                "type": "integer",
                "minimum": 0
              },
              "sha256": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              }
            }
          }
        },
        "reason": {
          "type": "string"
        }
      }
    },
    "warnings": {
      "type": "array",
      "description": "Notices about the reply, such as OODS-W004 when the page and the generated files were written to files because they were too large to return.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      }
    },
    "validationReceipt": {
      "$ref": "#/$defs/validationReceipt",
      "description": "Mandatory generation-profile disclosure. Pipeline preserves code_generate checks and accepted caller-supplied evidence envelopes, verifies the child receipt against the requested profile and artifact, and records target resolution provenance."
    },
    "schemaRef": {
      "type": "string",
      "description": "Schema reference returned by compose, reusable across tools."
    },
    "schemaRefCreatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO timestamp when the schemaRef was created."
    },
    "schemaRefExpiresAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO timestamp when the schemaRef expires. Save it with the schema tool (action: save) to keep it past expiry."
    },
    "schemaRefTtlWarning": {
      "type": "object",
      "additionalProperties": false,
      "description": "Proactive warning when schemaRef TTL is approaching expiration (< 5 minutes remaining).",
      "required": [
        "message",
        "remainingMs",
        "recommendation"
      ],
      "properties": {
        "message": {
          "type": "string",
          "description": "Human-readable warning message."
        },
        "remainingMs": {
          "type": "number",
          "description": "Milliseconds remaining until schemaRef expires."
        },
        "recommendation": {
          "type": "string",
          "description": "Actionable recommendation for the agent."
        }
      }
    },
    "compose": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "layout",
        "componentCount"
      ],
      "properties": {
        "object": {
          "type": "string"
        },
        "context": {
          "type": "string"
        },
        "layout": {
          "type": "string"
        },
        "componentCount": {
          "type": "number",
          "minimum": 0
        },
        "resolvedActions": {
          "type": "array",
          "description": "verbs grouped by trait after action_mappings reconciliation.",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "trait",
              "verbs"
            ],
            "properties": {
              "trait": {
                "type": "string"
              },
              "verbs": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "validation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "errors",
        "warnings"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "ok",
            "invalid",
            "skipped"
          ]
        },
        "errors": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/issue"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/issue"
          }
        }
      }
    },
    "render": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "meta"
      ],
      "properties": {
        "html": {
          "type": "string",
          "description": "Rendered HTML when renderApply=true."
        },
        "tokenCssRef": {
          "type": "string",
          "description": "Reference to token CSS artifact when compact mode is enabled."
        },
        "meta": {
          "type": "object",
          "additionalProperties": true,
          "description": "Render metadata summary."
        }
      }
    },
    "code": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "framework",
        "styling"
      ],
      "properties": {
        "framework": {
          "type": "string",
          "enum": [
            "react",
            "vue",
            "html"
          ]
        },
        "styling": {
          "type": "string",
          "enum": [
            "inline",
            "tokens",
            "tailwind"
          ]
        },
        "artifact": {
          "$ref": "#/$defs/generatedArtifact",
          "description": "Primary code-generation payload carried without flattening."
        }
      }
    },
    "saved": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "version"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "version": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "summary": {
      "type": "string",
      "description": "One-line natural language description of what was generated."
    },
    "metrics": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "totalNodes": {
          "type": "integer",
          "minimum": 0
        },
        "componentsUsed": {
          "type": "integer",
          "minimum": 0
        },
        "fieldsBound": {
          "type": "integer",
          "minimum": 0
        },
        "responseBytes": {
          "type": "integer",
          "minimum": 0
        },
        "fieldsOmitted": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "field",
              "reason"
            ],
            "properties": {
              "field": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          }
        }
      },
      "description": "Quality metrics for the pipeline output."
    },
    "pipeline": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "steps",
        "duration"
      ],
      "properties": {
        "steps": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "compose",
              "validate",
              "render",
              "codegen",
              "save"
            ]
          }
        },
        "stepLatency": {
          "type": "object",
          "additionalProperties": {
            "type": "number",
            "minimum": 0
          },
          "description": "Per-step latency in milliseconds."
        },
        "duration": {
          "type": "number",
          "minimum": 0
        }
      }
    },
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "step",
        "code",
        "message"
      ],
      "properties": {
        "step": {
          "type": "string",
          "enum": [
            "compose",
            "validate",
            "render",
            "codegen",
            "save"
          ]
        },
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  },
  "$defs": {
    "generatedArtifact": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "framework",
        "files",
        "dependencies",
        "actions",
        "contentHash"
      ],
      "properties": {
        "substitutions": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "mappingId",
              "component",
              "source"
            ],
            "additionalProperties": false,
            "properties": {
              "packageContentHash": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              },
              "mappingId": {
                "type": "string",
                "minLength": 1
              },
              "component": {
                "type": "string"
              },
              "source": {
                "type": "object",
                "required": [
                  "export"
                ],
                "additionalProperties": false,
                "properties": {
                  "package": {
                    "type": "string",
                    "minLength": 1
                  },
                  "export": {
                    "type": "string",
                    "pattern": "^[A-Za-z_$][\\w$]*$"
                  },
                  "passthrough": {
                    "type": "boolean",
                    "default": true,
                    "description": "Unlisted OODS Foundry props keep their names. False drops unlisted optional props; required props must be translated."
                  },
                  "props": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "object",
                      "required": [
                        "name"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "name": {
                          "type": "string",
                          "pattern": "^[A-Za-z_$][\\w$]*$"
                        },
                        "values": {
                          "type": "object",
                          "additionalProperties": {
                            "type": [
                              "string",
                              "number",
                              "boolean",
                              "null"
                            ]
                          }
                        }
                      }
                    },
                    "description": "OODS Foundry prop to team prop, with optional scalar value map; values not in the map are preserved. Children, slots and event bindings keep their framework conventions."
                  },
                  "version": {
                    "type": "string",
                    "pattern": "^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$",
                    "description": "Exact team package version; code generation needs this or an installed package manifest."
                  },
                  "shadcn": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "module",
                      "file",
                      "closureHash",
                      "css",
                      "files",
                      "hashFiles",
                      "paths",
                      "dependencies",
                      "imports"
                    ],
                    "properties": {
                      "module": {
                        "type": "string"
                      },
                      "file": {
                        "type": "string"
                      },
                      "closureHash": {
                        "type": "string",
                        "pattern": "^sha256:[a-f0-9]{64}$"
                      },
                      "css": {
                        "type": "string"
                      },
                      "files": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "hashFiles": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "paths": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "dependencies": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "imports": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "oneOf": [
                  {
                    "required": [
                      "package",
                      "version"
                    ],
                    "not": {
                      "required": [
                        "shadcn"
                      ]
                    }
                  },
                  {
                    "required": [
                      "shadcn"
                    ],
                    "not": {
                      "anyOf": [
                        {
                          "required": [
                            "package"
                          ]
                        },
                        {
                          "required": [
                            "version"
                          ]
                        }
                      ]
                    }
                  }
                ]
              }
            }
          }
        },
        "schemaVersion": {
          "type": "string",
          "const": "1.0.0"
        },
        "framework": {
          "type": "string",
          "enum": [
            "react",
            "vue",
            "html"
          ]
        },
        "files": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/generatedArtifactFile"
          }
        },
        "dependencies": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/generatedDependency"
          }
        },
        "actions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/generatedArtifactAction"
          },
          "description": "Required consumer-supplied domain actions in deterministic name order. An empty array means the generated UI needs no domain-action injection."
        },
        "contentHash": {
          "$ref": "#/$defs/contentHash"
        }
      }
    },
    "generatedArtifactFile": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "path",
        "contents",
        "contentHash"
      ],
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1,
          "pattern": "^(?!/)(?!.*\\\\)(?!.*(?:^|/)\\.\\.?(?:/|$))[^/]+(?:/[^/]+)*$"
        },
        "contents": {
          "type": "string"
        },
        "contentHash": {
          "$ref": "#/$defs/contentHash"
        }
      }
    },
    "generatedDependency": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "version",
        "kind"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "version": {
          "type": "string",
          "pattern": "^(?:0|[1-9][0-9]*)\\.(?:0|[1-9][0-9]*)\\.(?:0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
        },
        "kind": {
          "type": "string",
          "enum": [
            "dependency",
            "peerDependency"
          ]
        }
      }
    },
    "generatedArtifactAction": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "parameters",
        "sources"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "pattern": "^[$_\\p{ID_Start}][$_\\u200c\\u200d\\p{ID_Continue}]*$",
          "description": "Consumer injection name shared by all compatible occurrences."
        },
        "parameters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/generatedArtifactActionParameter"
          },
          "description": "Cross-framework parameter contract in canonical semantic call order."
        },
        "sources": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/generatedArtifactActionSource"
          },
          "description": "Schema declaration sources; component sources are generated-tree events, while screen-root sources drive generated action controls. Deterministic node-event-component order."
        }
      }
    },
    "validationReceipt": {
      "type": "object",
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "profile": {
                "type": "string",
                "const": "release"
              }
            },
            "required": [
              "profile"
            ]
          },
          "then": {
            "required": [
              "evidenceVerification"
            ]
          }
        },
        {
          "$ref": "#/$defs/validationReceiptPartition"
        },
        {
          "$ref": "#/$defs/validationProfilePolicy"
        }
      ],
      "required": [
        "profile",
        "defaulted",
        "rationale",
        "axes",
        "checks",
        "notChecked",
        "evidence"
      ],
      "properties": {
        "evidenceVerification": {
          "type": "string",
          "const": "file-verified-not-re-executed",
          "description": "Release evidence references are format-checked and bound to the generated artifact hash, not independently re-executed."
        },
        "profile": {
          "type": "string",
          "enum": [
            "draft",
            "build",
            "release"
          ]
        },
        "defaulted": {
          "type": "boolean"
        },
        "rationale": {
          "type": "string",
          "minLength": 1
        },
        "axes": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "scope",
            "enforcement",
            "fallback",
            "target"
          ],
          "properties": {
            "scope": {
              "type": "string",
              "enum": [
                "structural",
                "generated-artifact",
                "release-evidence"
              ]
            },
            "enforcement": {
              "type": "string",
              "enum": [
                "advisory",
                "blocking"
              ]
            },
            "fallback": {
              "type": "string",
              "enum": [
                "visible",
                "forbidden"
              ]
            },
            "target": {
              "$ref": "#/$defs/targetResolution"
            }
          }
        },
        "checks": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/validationCheck"
          }
        },
        "notChecked": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/validationCheck"
          }
        },
        "evidence": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "required",
            "provided",
            "missing",
            "mismatched",
            "accepted",
            "notApplicable"
          ],
          "properties": {
            "required": {
              "$ref": "#/$defs/evidenceClassList"
            },
            "provided": {
              "$ref": "#/$defs/evidenceClassList"
            },
            "missing": {
              "$ref": "#/$defs/evidenceClassList"
            },
            "mismatched": {
              "$ref": "#/$defs/evidenceClassList"
            },
            "accepted": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/acceptedReleaseEvidence"
              },
              "description": "Caller-supplied release-evidence envelopes accepted for evaluation in canonical class order; references are retained for auditability, not claimed as independently executed."
            },
            "notApplicable": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "class",
                  "rationale"
                ],
                "properties": {
                  "class": {
                    "$ref": "#/$defs/evidenceClass"
                  },
                  "rationale": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              }
            },
            "artifactContentHash": {
              "$ref": "#/$defs/contentHash"
            }
          }
        }
      }
    },
    "targetResolution": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "resolved",
        "source"
      ],
      "properties": {
        "requested": {
          "type": "string",
          "enum": [
            "react",
            "vue",
            "html"
          ]
        },
        "resolved": {
          "type": "string",
          "enum": [
            "react",
            "vue",
            "html"
          ]
        },
        "source": {
          "type": "string",
          "enum": [
            "explicit",
            "options-alias",
            "oodsrc",
            "default"
          ]
        }
      }
    },
    "validationCheck": {
      "type": "string",
      "enum": [
        "schema-structure",
        "component-registry",
        "state-contract",
        "binding-contract",
        "props-contract",
        "slots-contract",
        "events-contract",
        "target-readiness",
        "normalization-fidelity",
        "dependency-closure",
        "fallback-policy",
        "rendered-evidence",
        "interaction-evidence",
        "accessibility-evidence",
        "theme-evidence",
        "determinism-evidence",
        "performance-evidence",
        "certification-evidence"
      ]
    },
    "validationReceiptPartition": {
      "type": "object",
      "allOf": [
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "schema-structure"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "schema-structure"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "component-registry"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "component-registry"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "state-contract"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "state-contract"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "target-readiness"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "target-readiness"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "normalization-fidelity"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "normalization-fidelity"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "binding-contract"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "binding-contract"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "props-contract"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "props-contract"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "slots-contract"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "slots-contract"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "events-contract"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "events-contract"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "dependency-closure"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "dependency-closure"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "fallback-policy"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "fallback-policy"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "rendered-evidence"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "rendered-evidence"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "interaction-evidence"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "interaction-evidence"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "accessibility-evidence"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "accessibility-evidence"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "theme-evidence"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "theme-evidence"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "determinism-evidence"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "determinism-evidence"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "performance-evidence"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "performance-evidence"
                  }
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "checks": {
                  "contains": {
                    "type": "string",
                    "const": "certification-evidence"
                  }
                }
              }
            },
            {
              "properties": {
                "notChecked": {
                  "contains": {
                    "type": "string",
                    "const": "certification-evidence"
                  }
                }
              }
            }
          ]
        }
      ]
    },
    "validationProfilePolicy": {
      "type": "object",
      "allOf": [
        {
          "if": {
            "properties": {
              "profile": {
                "type": "string",
                "const": "draft"
              }
            },
            "required": [
              "profile"
            ]
          },
          "then": {
            "properties": {
              "rationale": {
                "type": "string",
                "const": "Draft reports target and fallback gaps without claiming a runnable artifact."
              },
              "axes": {
                "properties": {
                  "scope": {
                    "type": "string",
                    "const": "structural"
                  },
                  "enforcement": {
                    "type": "string",
                    "const": "advisory"
                  },
                  "fallback": {
                    "type": "string",
                    "const": "visible"
                  }
                }
              },
              "evidence": {
                "properties": {
                  "required": {
                    "type": "array",
                    "const": []
                  }
                }
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "profile": {
                "type": "string",
                "const": "build"
              }
            },
            "required": [
              "profile"
            ]
          },
          "then": {
            "properties": {
              "rationale": {
                "type": "string",
                "const": "Build is the default blocking gate: target, bindings, dependencies and fallbacks must resolve under static checks; the static gate does not install or run the generated application."
              },
              "axes": {
                "properties": {
                  "scope": {
                    "type": "string",
                    "const": "generated-artifact"
                  },
                  "enforcement": {
                    "type": "string",
                    "const": "blocking"
                  },
                  "fallback": {
                    "type": "string",
                    "const": "forbidden"
                  }
                }
              },
              "evidence": {
                "properties": {
                  "required": {
                    "type": "array",
                    "const": []
                  }
                }
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "profile": {
                "type": "string",
                "const": "release"
              }
            },
            "required": [
              "profile"
            ]
          },
          "then": {
            "properties": {
              "rationale": {
                "type": "string",
                "const": "Release adds six local JSON evidence files with verified byte hashes, passed status and artifact binding to the build gate, and records server-owned certification as not applicable for generated UI targets."
              },
              "axes": {
                "properties": {
                  "scope": {
                    "type": "string",
                    "const": "release-evidence"
                  },
                  "enforcement": {
                    "type": "string",
                    "const": "blocking"
                  },
                  "fallback": {
                    "type": "string",
                    "const": "forbidden"
                  }
                }
              },
              "evidence": {
                "properties": {
                  "required": {
                    "type": "array",
                    "const": [
                      "rendered",
                      "interaction",
                      "accessibility",
                      "theme",
                      "determinism",
                      "performance"
                    ]
                  }
                }
              }
            }
          }
        }
      ]
    },
    "buildChecksCompleted": {
      "type": "object",
      "properties": {
        "checks": {
          "allOf": [
            {
              "contains": {
                "type": "string",
                "const": "schema-structure"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "component-registry"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "state-contract"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "target-readiness"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "normalization-fidelity"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "binding-contract"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "props-contract"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "slots-contract"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "events-contract"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "dependency-closure"
              }
            }
          ]
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "axes": {
                "properties": {
                  "target": {
                    "properties": {
                      "resolved": {
                        "type": "string",
                        "const": "html"
                      }
                    }
                  }
                }
              }
            }
          },
          "then": {
            "properties": {
              "checks": {
                "contains": {
                  "type": "string",
                  "const": "fallback-policy"
                }
              }
            }
          }
        }
      ]
    },
    "releaseSuccessReceipt": {
      "type": "object",
      "properties": {
        "checks": {
          "allOf": [
            {
              "contains": {
                "type": "string",
                "const": "rendered-evidence"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "interaction-evidence"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "accessibility-evidence"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "theme-evidence"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "determinism-evidence"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "performance-evidence"
              }
            },
            {
              "contains": {
                "type": "string",
                "const": "certification-evidence"
              }
            }
          ]
        },
        "evidence": {
          "properties": {
            "provided": {
              "type": "array",
              "const": [
                "rendered",
                "interaction",
                "accessibility",
                "theme",
                "determinism",
                "performance"
              ]
            },
            "missing": {
              "type": "array",
              "const": []
            },
            "mismatched": {
              "type": "array",
              "const": []
            },
            "accepted": {
              "minItems": 6,
              "maxItems": 6,
              "prefixItems": [
                {
                  "properties": {
                    "class": {
                      "type": "string",
                      "const": "rendered"
                    }
                  }
                },
                {
                  "properties": {
                    "class": {
                      "type": "string",
                      "const": "interaction"
                    }
                  }
                },
                {
                  "properties": {
                    "class": {
                      "type": "string",
                      "const": "accessibility"
                    }
                  }
                },
                {
                  "properties": {
                    "class": {
                      "type": "string",
                      "const": "theme"
                    }
                  }
                },
                {
                  "properties": {
                    "class": {
                      "type": "string",
                      "const": "determinism"
                    }
                  }
                },
                {
                  "properties": {
                    "class": {
                      "type": "string",
                      "const": "performance"
                    }
                  }
                }
              ]
            },
            "notApplicable": {
              "contains": {
                "properties": {
                  "class": {
                    "type": "string",
                    "const": "certification"
                  }
                }
              }
            }
          }
        }
      }
    },
    "evidenceClass": {
      "type": "string",
      "enum": [
        "rendered",
        "interaction",
        "accessibility",
        "theme",
        "determinism",
        "performance",
        "certification"
      ]
    },
    "evidenceClassList": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "$ref": "#/$defs/evidenceClass"
      }
    },
    "acceptedReleaseEvidence": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "class",
        "status",
        "artifactContentHash",
        "reference",
        "contentHash"
      ],
      "properties": {
        "class": {
          "type": "string",
          "enum": [
            "rendered",
            "interaction",
            "accessibility",
            "theme",
            "determinism",
            "performance"
          ]
        },
        "status": {
          "type": "string",
          "const": "passed"
        },
        "artifactContentHash": {
          "$ref": "#/$defs/contentHash"
        },
        "reference": {
          "type": "string",
          "minLength": 1,
          "description": "Local JSON evidence file, absolute or relative to the server working directory. Opened during release validation."
        },
        "contentHash": {
          "type": "string",
          "pattern": "^sha256:[a-f0-9]{64}$",
          "description": "SHA-256 of the local JSON evidence file bytes. The file must contain status: passed and this artifactContentHash."
        }
      }
    },
    "generatedArtifactActionParameter": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "type"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "type": "string",
          "minLength": 1,
          "description": "Portable TypeScript-style parameter type shared across framework targets."
        }
      }
    },
    "generatedArtifactActionSource": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "nodeId",
        "component",
        "event"
      ],
      "properties": {
        "nodeId": {
          "type": "string",
          "minLength": 1
        },
        "component": {
          "type": "string",
          "minLength": 1
        },
        "event": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "contentHash": {
      "type": "string",
      "pattern": "^sha256:[a-f0-9]{64}$"
    },
    "issue": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "hint": {
          "type": "string"
        },
        "severity": {
          "type": "string"
        },
        "nodeId": {
          "type": "string"
        },
        "component": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  }
}
