{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Controller-Fixed RequestedAct (schema 1)",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "environment_id", "worker", "actor", "task_binding", "source", "source_generation", "source_tenancy", "act"],
  "properties": {
    "schema": { "const": 1 },
    "environment_id": { "type": "string" },
    "worker": { "type": "string" },
    "actor": { "type": "string" },
    "task_binding": { "type": "object" },
    "source": { "type": "object" },
    "source_generation": { "type": "integer", "minimum": 0 },
    "source_tenancy": {
      "type": "object",
      "required": ["scope", "task", "generation", "control_epoch"],
      "properties": {
        "scope": { "type": "string" },
        "task": { "type": "string" },
        "generation": { "type": "integer", "minimum": 0 },
        "control_epoch": { "type": "integer", "minimum": 0 }
      }
    },
    "act": {
      "type": "object",
      "required": ["key", "key_field", "destination"],
      "properties": {
        "key": { "type": ["string", "integer"] },
        "key_field": { "type": "string" },
        "destination": {
          "type": "object",
          "required": ["action", "destination", "target", "fields", "expected_version", "content_sha256", "version_after"],
          "properties": {
            "action": { "const": "field_change" },
            "destination": { "const": "sqlite.records" },
            "target": { "type": "string" },
            "fields": { "type": "object", "minProperties": 1, "maxProperties": 64 },
            "expected_version": { "type": "integer", "minimum": 0 },
            "content_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
            "version_after": { "type": "integer", "minimum": 1 }
          }
        }
      }
    }
  },
  "description": "Declaration of the immutable controller-fixed act record. Its reference is the RFC 8785 JCS SHA-256 digest of the body; execution logic is intentionally not published."
}
