{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:zeon:ra153-1-2:implementation:v0.2",
  "title": "RA-153.1-2 Implementation Schemas v0.2",
  "description": "Machine-readable artifact schemas derived from RA-153.1-2 WP006 v1.6 Scientific Edition.",
  "$defs": {
    "CommonMeta": {
      "type": "object",
      "required": [
        "ra_version",
        "artifact_type",
        "artifact_version",
        "id",
        "created_at"
      ],
      "properties": {
        "ra_version": {
          "const": "RA-153.1-2"
        },
        "artifact_type": {
          "type": "string"
        },
        "artifact_version": {
          "type": "string",
          "pattern": "^\\d+\\.\\d+\\.\\d+$"
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "correlation_id": {
          "type": "string"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "producer": {
          "type": "string"
        },
        "provenance": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "integrity": {
          "type": "object",
          "properties": {
            "digest_alg": {
              "type": "string"
            },
            "digest": {
              "type": "string"
            },
            "signature_ref": {
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "R0_RequestEnvelope": {
      "type": "object",
      "required": [
        "meta",
        "request",
        "actor",
        "org_context",
        "time",
        "authority_sources"
      ],
      "properties": {
        "meta": {
          "$ref": "#/$defs/CommonMeta"
        },
        "request": {
          "type": "object",
          "required": [
            "content"
          ],
          "properties": {
            "content": {},
            "content_type": {
              "type": "string"
            },
            "channel": {
              "type": "string"
            },
            "requested_effect": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "additionalProperties": true
        },
        "actor": {
          "type": "object",
          "required": [
            "actor_id"
          ],
          "properties": {
            "actor_id": {
              "type": "string"
            },
            "actor_type": {
              "type": "string",
              "enum": [
                "human",
                "service",
                "agent",
                "organization",
                "unknown"
              ]
            },
            "roles": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "authn_context": {
              "type": [
                "object",
                "null"
              ]
            }
          },
          "additionalProperties": true
        },
        "org_context": {
          "type": "object",
          "additionalProperties": true
        },
        "time": {
          "type": "object",
          "required": [
            "received_at"
          ],
          "properties": {
            "received_at": {
              "type": "string",
              "format": "date-time"
            },
            "not_before": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            },
            "expires_at": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            }
          },
          "additionalProperties": false
        },
        "authority_sources": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "source_id",
              "source_type",
              "authority_class"
            ],
            "properties": {
              "source_id": {
                "type": "string"
              },
              "source_type": {
                "type": "string",
                "enum": [
                  "actor",
                  "policy",
                  "delegation",
                  "document",
                  "tool",
                  "system",
                  "external"
                ]
              },
              "authority_class": {
                "type": "string",
                "enum": [
                  "principal",
                  "policy",
                  "delegated",
                  "informational",
                  "untrusted"
                ]
              },
              "can_authorize_fields": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "provenance_ref": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "additionalProperties": false
          }
        },
        "field_ownership": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "R1_NeedDescriptor": {
      "type": "object",
      "required": [
        "meta",
        "intents",
        "objects",
        "constraints",
        "ambiguities",
        "sensitivity",
        "confidence",
        "authority_analysis"
      ],
      "properties": {
        "meta": {
          "$ref": "#/$defs/CommonMeta"
        },
        "intents": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "objects": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "constraints": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "ambiguities": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "sensitivity": {
          "type": "object",
          "properties": {
            "level": {
              "type": "string",
              "enum": [
                "unknown",
                "low",
                "moderate",
                "high",
                "critical"
              ]
            },
            "reasons": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "level"
          ],
          "additionalProperties": false
        },
        "confidence": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "provenance": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "authority_analysis": {
          "type": "object",
          "required": [
            "effective_principal",
            "informational_sources",
            "untrusted_sources"
          ],
          "properties": {
            "effective_principal": {
              "type": "string"
            },
            "informational_sources": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "untrusted_sources": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "authority_notes": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "R2_CapabilityRequirementSet": {
      "type": "object",
      "required": [
        "meta",
        "capabilities",
        "modalities",
        "data_access",
        "tool_classes",
        "evidence_needs",
        "authority_ceiling"
      ],
      "properties": {
        "meta": {
          "$ref": "#/$defs/CommonMeta"
        },
        "capabilities": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "modalities": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "data_access": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "tool_classes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "evidence_needs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "hard_requirements": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "preferences": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "authority_ceiling": {
          "type": "object",
          "required": [
            "principal_id",
            "allowed_actions",
            "allowed_tool_classes",
            "source_refs"
          ],
          "properties": {
            "principal_id": {
              "type": "string"
            },
            "allowed_actions": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "allowed_tool_classes": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "max_cost": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0
            },
            "max_side_effects": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 0
            },
            "source_refs": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "additionalProperties": false
        },
        "parent_scope_digest": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    "R3_StrategySet": {
      "type": "object",
      "required": [
        "meta",
        "candidate_strategies"
      ],
      "properties": {
        "meta": {
          "$ref": "#/$defs/CommonMeta"
        },
        "candidate_strategies": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "strategy_id",
              "steps",
              "dependencies",
              "stop_conditions",
              "risks",
              "proof_needs",
              "authority_requirements",
              "security_context_requirements"
            ],
            "properties": {
              "strategy_id": {
                "type": "string"
              },
              "strategy_type": {
                "type": "string"
              },
              "steps": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "dependencies": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "stop_conditions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "risks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "proof_needs": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "estimated_cost": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0
              },
              "estimated_latency_ms": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "authority_requirements": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "security_context_requirements": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },
    "R4_GovernanceDecisionMandate": {
      "type": "object",
      "required": [
        "meta",
        "outcome",
        "authority",
        "policy_versions",
        "obligations",
        "admissibility",
        "proof_requirements",
        "principal",
        "delegation_chain",
        "resource_binding",
        "security_context",
        "human_gate"
      ],
      "properties": {
        "meta": {
          "$ref": "#/$defs/CommonMeta"
        },
        "outcome": {
          "type": "string",
          "enum": [
            "EXECUTE",
            "ABSTAIN",
            "REFUSE",
            "ESCALATE"
          ]
        },
        "authority": {
          "type": "object",
          "required": [
            "authority_type",
            "authority_id"
          ],
          "properties": {
            "authority_type": {
              "type": "string",
              "enum": [
                "policy",
                "human",
                "role",
                "committee",
                "external_authority"
              ]
            },
            "authority_id": {
              "type": "string"
            },
            "decision_ref": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "additionalProperties": false
        },
        "policy_versions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1
        },
        "obligations": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "admissibility": {
          "type": "object",
          "properties": {
            "allowed_resource_ids": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "allowed_resource_classes": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "denied_resource_ids": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "jurisdictions": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "conditions": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "additionalProperties": false
        },
        "scope": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "actions": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "objects": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "max_cost": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0
            },
            "max_side_effects": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 0
            }
          },
          "additionalProperties": true
        },
        "issued_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "not_before": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "expiry": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "revocation_ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "human_gate": {
          "type": "object",
          "required": [
            "required",
            "status",
            "decision_packet"
          ],
          "properties": {
            "required": {
              "type": "boolean"
            },
            "status": {
              "type": "string",
              "enum": [
                "not_required",
                "pending",
                "approved",
                "rejected",
                "deferred"
              ]
            },
            "approver_ref": {
              "type": [
                "string",
                "null"
              ]
            },
            "approved_at": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            },
            "decision_packet": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "question": {
                  "type": "string"
                },
                "decision_owner": {
                  "type": "string"
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "consequences": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "uncertainties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "provenance": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "contestable": {
                  "type": "boolean"
                }
              },
              "required": [
                "question",
                "decision_owner",
                "options",
                "consequences",
                "uncertainties",
                "provenance",
                "contestable"
              ],
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        },
        "proof_requirements": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "rationale": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "principal": {
          "type": "object",
          "required": [
            "principal_id",
            "principal_type"
          ],
          "properties": {
            "principal_id": {
              "type": "string"
            },
            "principal_type": {
              "type": "string",
              "enum": [
                "human",
                "service",
                "agent",
                "organization",
                "role",
                "committee"
              ]
            },
            "authenticated": {
              "type": "boolean"
            }
          },
          "additionalProperties": false
        },
        "delegation_chain": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "delegator",
              "delegatee",
              "parent_mandate_id",
              "scope_digest"
            ],
            "properties": {
              "delegator": {
                "type": "string"
              },
              "delegatee": {
                "type": "string"
              },
              "parent_mandate_id": {
                "type": "string"
              },
              "scope_digest": {
                "type": "string"
              },
              "delegated_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "additionalProperties": false
          }
        },
        "resource_binding": {
          "type": "object",
          "required": [
            "audience",
            "resources"
          ],
          "properties": {
            "audience": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "resources": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "additionalProperties": false
        },
        "security_context": {
          "type": "object",
          "required": [
            "context_id",
            "authority_sources_digest",
            "policy_context_digest",
            "scope_ceiling_digest"
          ],
          "properties": {
            "context_id": {
              "type": "string"
            },
            "authority_sources_digest": {
              "type": "string"
            },
            "policy_context_digest": {
              "type": "string"
            },
            "scope_ceiling_digest": {
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "outcome": {
                "const": "EXECUTE"
              }
            }
          },
          "then": {
            "required": [
              "scope",
              "issued_at",
              "expiry"
            ]
          }
        }
      ],
      "additionalProperties": false
    },
    "R5_ExecutionBinding": {
      "type": "object",
      "required": [
        "meta",
        "mandate_id",
        "selected_resources",
        "action_binding",
        "runtime_identity",
        "security_context",
        "delegation_chain_digest",
        "mandate_snapshot_digest"
      ],
      "properties": {
        "meta": {
          "$ref": "#/$defs/CommonMeta"
        },
        "mandate_id": {
          "type": "string"
        },
        "selected_resources": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1
        },
        "action_binding": {
          "type": "object",
          "required": [
            "action_id",
            "action_type",
            "parameters_digest"
          ],
          "properties": {
            "action_id": {
              "type": "string"
            },
            "action_type": {
              "type": "string"
            },
            "parameters_digest": {
              "type": "string"
            },
            "idempotency_key": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "additionalProperties": true
        },
        "runtime_identity": {
          "type": "object",
          "required": [
            "runtime_id"
          ],
          "properties": {
            "runtime_id": {
              "type": "string"
            },
            "principal_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "attestation_ref": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "additionalProperties": true
        },
        "preconditions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "bound_at": {
          "type": "string",
          "format": "date-time"
        },
        "security_context": {
          "type": "object",
          "required": [
            "context_id",
            "authority_sources_digest",
            "policy_context_digest",
            "scope_ceiling_digest"
          ],
          "properties": {
            "context_id": {
              "type": "string"
            },
            "authority_sources_digest": {
              "type": "string"
            },
            "policy_context_digest": {
              "type": "string"
            },
            "scope_ceiling_digest": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "delegation_chain_digest": {
          "type": "string"
        },
        "mandate_snapshot_digest": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "R6_EvidenceBundle": {
      "type": "object",
      "required": [
        "meta",
        "decision",
        "mandate",
        "action_identity",
        "receipts",
        "digests",
        "timestamps",
        "verification",
        "execution_claim",
        "observed_effects",
        "evidence_independence"
      ],
      "properties": {
        "meta": {
          "$ref": "#/$defs/CommonMeta"
        },
        "decision": {
          "type": "string"
        },
        "mandate": {
          "type": "string"
        },
        "action_identity": {
          "type": "string"
        },
        "receipts": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "digests": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "timestamps": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "date-time"
          }
        },
        "attestations": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "verification": {
          "type": "object",
          "required": [
            "mandate_valid",
            "action_within_scope",
            "resource_admissible",
            "security_context_continuity",
            "delegation_monotonicity",
            "effect_observed"
          ],
          "properties": {
            "mandate_valid": {
              "type": "boolean"
            },
            "action_within_scope": {
              "type": "boolean"
            },
            "resource_admissible": {
              "type": "boolean"
            },
            "evidence_complete": {
              "type": "boolean"
            },
            "notes": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "security_context_continuity": {
              "type": "boolean"
            },
            "delegation_monotonicity": {
              "type": "boolean"
            },
            "effect_observed": {
              "type": "boolean"
            }
          },
          "additionalProperties": false
        },
        "execution_claim": {
          "type": "object",
          "required": [
            "status",
            "action_type"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "claimed_success",
                "claimed_failure",
                "unknown"
              ]
            },
            "action_type": {
              "type": "string"
            },
            "source": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "observed_effects": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "effect_type",
              "status",
              "digest"
            ],
            "properties": {
              "effect_type": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "digest": {
                "type": "string"
              },
              "observed_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "additionalProperties": true
          }
        },
        "evidence_independence": {
          "type": "object",
          "required": [
            "producer_class",
            "substrate_class",
            "auditor_class",
            "level"
          ],
          "properties": {
            "producer_class": {
              "type": "string"
            },
            "substrate_class": {
              "type": "string"
            },
            "auditor_class": {
              "type": "string"
            },
            "level": {
              "type": "string",
              "enum": [
                "SELF_REPORTED",
                "ATTESTED",
                "INDEPENDENT"
              ]
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    }
  }
}
