{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agents.govp.io/spec/0.1-draft/govp-agent-claims.schema.json",
  "title": "GOVP Agent Claims 0.1 Draft",
  "description": "Claims for GOVP evidence about agent authority, delegation, approval, execution, delivery, and witnessing. This draft is not stable.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "profile_version",
    "event_type",
    "receipt_role",
    "actor",
    "protocol",
    "action",
    "result",
    "observation",
    "causal_links",
    "privacy"
  ],
  "properties": {
    "profile_version": {
      "const": "0.1.0-draft.1"
    },
    "event_type": {
      "$ref": "#/$defs/eventType"
    },
    "receipt_role": {
      "enum": [
        "authorization",
        "delegation",
        "acceptance",
        "approval",
        "execution",
        "delivery",
        "witness"
      ]
    },
    "actor": {
      "$ref": "#/$defs/actor"
    },
    "protocol": {
      "$ref": "#/$defs/protocol"
    },
    "action": {
      "$ref": "#/$defs/action"
    },
    "result": {
      "$ref": "#/$defs/result"
    },
    "observation": {
      "$ref": "#/$defs/observation"
    },
    "causal_links": {
      "type": "array",
      "maxItems": 64,
      "items": {
        "$ref": "#/$defs/causalLink"
      }
    },
    "privacy": {
      "$ref": "#/$defs/privacy"
    },
    "authorization": {
      "$ref": "#/$defs/authorization"
    },
    "approval": {
      "$ref": "#/$defs/approval"
    },
    "artifacts": {
      "type": "array",
      "maxItems": 128,
      "items": {
        "$ref": "#/$defs/artifact"
      }
    }
  },
  "$defs": {
    "digest": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "algorithm",
        "value"
      ],
      "properties": {
        "algorithm": {
          "const": "sha-256"
        },
        "value": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{43}$"
        }
      }
    },
    "commitment": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "method",
        "representation",
        "value"
      ],
      "properties": {
        "method": {
          "enum": [
            "sha-256",
            "hmac-sha-256",
            "salted-sha-256"
          ]
        },
        "representation": {
          "enum": [
            "JCS-RFC8785",
            "raw-bytes",
            "profile-defined"
          ]
        },
        "value": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{43}$"
        },
        "context_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      }
    },
    "eventType": {
      "enum": [
        "authorization.issued",
        "authorization.denied",
        "authorization.consumed",
        "authorization.expired",
        "authorization.revoked",
        "task.delegated",
        "task.accepted",
        "task.rejected",
        "task.cancelled",
        "task.completed",
        "task.failed",
        "approval.requested",
        "approval.responded",
        "approval.granted",
        "approval.denied",
        "approval.expired",
        "approval.revoked",
        "tool.call_requested",
        "tool.call_authorized",
        "tool.call_denied",
        "tool.call_accepted",
        "tool.call_succeeded",
        "tool.call_failed",
        "tool.task_started",
        "tool.task_completed",
        "artifact.produced",
        "artifact.updated",
        "artifact.delivered",
        "artifact.rejected",
        "evidence.received",
        "evidence.checkpointed",
        "evidence.timestamped",
        "evidence.disclosed"
      ]
    },
    "actor": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "kind",
        "role"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "kind": {
          "enum": [
            "agent",
            "human",
            "service",
            "tool",
            "gateway",
            "witness",
            "unknown"
          ]
        },
        "role": {
          "enum": [
            "issuer",
            "delegator",
            "receiver",
            "approver",
            "requester",
            "executor",
            "delivery_service",
            "witness",
            "unknown"
          ]
        }
      }
    },
    "protocol": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "family",
        "revision",
        "operation",
        "peer_id"
      ],
      "properties": {
        "family": {
          "enum": [
            "a2a",
            "mcp",
            "http",
            "sdk",
            "message_bus",
            "internal",
            "other"
          ]
        },
        "revision": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "not": {
            "enum": [
              "latest",
              "current",
              "*"
            ]
          }
        },
        "operation": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "interface_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "peer_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "request_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "task_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "context_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "correlation_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      }
    },
    "action": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "class",
        "name",
        "provider_id",
        "normalization",
        "input_commitment",
        "impact",
        "side_effect",
        "digest"
      ],
      "properties": {
        "class": {
          "enum": [
            "communicate",
            "read",
            "compute",
            "mutate",
            "transact",
            "administer",
            "actuate",
            "other"
          ]
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "provider_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "normalization": {
          "const": "org.govp.agent.action/JCS-0.1-draft"
        },
        "input_commitment": {
          "$ref": "#/$defs/commitment"
        },
        "target_class": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "target_commitment": {
          "$ref": "#/$defs/commitment"
        },
        "impact": {
          "enum": [
            "low",
            "moderate",
            "high",
            "critical"
          ]
        },
        "side_effect": {
          "enum": [
            "none",
            "read_only",
            "reversible",
            "irreversible",
            "unknown"
          ]
        },
        "digest": {
          "$ref": "#/$defs/digest"
        }
      },
      "dependentRequired": {
        "target_class": [
          "target_commitment"
        ],
        "target_commitment": [
          "target_class"
        ]
      }
    },
    "result": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status"
      ],
      "properties": {
        "status": {
          "enum": [
            "not_executed",
            "accepted",
            "succeeded",
            "failed",
            "partially_succeeded",
            "unknown"
          ]
        },
        "digest": {
          "$ref": "#/$defs/digest"
        },
        "error_class": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      }
    },
    "observation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "class",
        "capture_point",
        "captured_at",
        "time_assurance"
      ],
      "properties": {
        "class": {
          "enum": [
            "receiver_attested",
            "gateway_observed",
            "producer_declared",
            "not_observed"
          ]
        },
        "capture_point": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "id",
            "role"
          ],
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            },
            "role": {
              "enum": [
                "producer",
                "gateway",
                "receiver",
                "execution_service",
                "witness",
                "unknown"
              ]
            }
          }
        },
        "captured_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "time_assurance": {
          "enum": [
            "self_asserted",
            "trusted_timestamp",
            "checkpoint_anchored",
            "unknown"
          ]
        }
      }
    },
    "causalLink": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "relation",
        "evidence_id",
        "evidence_digest",
        "producer_id"
      ],
      "properties": {
        "relation": {
          "enum": [
            "authorizes",
            "delegates",
            "accepts",
            "requests_execution",
            "executes",
            "produces",
            "delivers",
            "witnesses",
            "supersedes",
            "revokes"
          ]
        },
        "evidence_id": {
          "type": "string",
          "format": "uuid"
        },
        "evidence_digest": {
          "$ref": "#/$defs/digest"
        },
        "producer_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      }
    },
    "privacy": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "mode",
        "disclosure_policy",
        "commitments"
      ],
      "properties": {
        "mode": {
          "enum": [
            "minimal",
            "balanced",
            "forensic"
          ]
        },
        "disclosure_policy": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "commitments": {
          "type": "array",
          "maxItems": 64,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "field",
              "sensitivity",
              "method"
            ],
            "properties": {
              "field": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "sensitivity": {
                "enum": [
                  "public",
                  "confidential",
                  "personal_low_entropy",
                  "secret"
                ]
              },
              "method": {
                "enum": [
                  "public_digest",
                  "keyed_digest",
                  "salted_commitment",
                  "encrypted_attachment",
                  "omitted"
                ]
              }
            }
          }
        },
        "withheld_fields": {
          "type": "array",
          "uniqueItems": true,
          "maxItems": 128,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      }
    },
    "authorization": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "grant_id",
        "issuer_id",
        "subject_id",
        "audience",
        "action_scope",
        "resource_scope_digest",
        "valid_from",
        "valid_until",
        "policy_digest",
        "use_semantics",
        "max_delegation_depth"
      ],
      "properties": {
        "grant_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "issuer_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "subject_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "audience": {
          "type": "array",
          "minItems": 1,
          "maxItems": 32,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "action_scope": {
          "type": "array",
          "minItems": 1,
          "maxItems": 8,
          "uniqueItems": true,
          "items": {
            "enum": [
              "communicate",
              "read",
              "compute",
              "mutate",
              "transact",
              "administer",
              "actuate",
              "other"
            ]
          }
        },
        "resource_scope_digest": {
          "$ref": "#/$defs/digest"
        },
        "valid_from": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "valid_until": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "policy_digest": {
          "$ref": "#/$defs/digest"
        },
        "use_semantics": {
          "enum": [
            "one_time",
            "bounded",
            "unbounded"
          ]
        },
        "use_limit": {
          "type": "integer",
          "minimum": 1
        },
        "nonce_commitment": {
          "$ref": "#/$defs/digest"
        },
        "max_delegation_depth": {
          "type": "integer",
          "minimum": 0,
          "maximum": 64
        }
      }
    },
    "approval": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "approver_id",
        "decision",
        "purpose",
        "action_digest",
        "valid_until",
        "nonce_commitment"
      ],
      "properties": {
        "approver_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "decision": {
          "enum": [
            "responded",
            "granted",
            "denied"
          ]
        },
        "purpose": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "action_digest": {
          "$ref": "#/$defs/digest"
        },
        "valid_until": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "nonce_commitment": {
          "$ref": "#/$defs/digest"
        }
      }
    },
    "artifact": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "digest"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "media_type": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "size": {
          "type": "integer",
          "minimum": 0
        },
        "digest": {
          "$ref": "#/$defs/digest"
        }
      }
    }
  }
}
