{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "schemas/runtime_event_loop_result.schema.json",
  "title": "runtime_event_loop_result.v1",
  "description": "task-2553+54 — ANU runtime event loop result. The loop interprets a durable-registry (callback_4tuple_index.jsonl) append/update as a progress event and immediately drives the next step: single-task next_action (+47), batch all-settled (+53), consolidated summary candidate, and a next-phase ANU-key dispatch CANDIDATE. The registry is the state source (read-only); schedule_history is audit only; a fixed-time gate / dead-man fallback is NEVER a progress trigger (FORBIDDEN_TRIGGER_SOURCE). All outputs are proposals — the loop has zero dispatch/merge/write authority.",
  "type": "object",
  "required": [
    "schema",
    "registry_path",
    "verdict",
    "fixed_time_used",
    "dead_man_used",
    "fallback_pending_non_blocking",
    "authority",
    "action_mode",
    "events_observed",
    "duplicate_events_suppressed",
    "single_task_results",
    "batch_results",
    "consolidated_summary_candidates",
    "dispatch_candidates"
  ],
  "properties": {
    "schema": {"const": "runtime_event_loop_result.v1"},
    "generated_at_kst": {"type": "string"},
    "registry_path": {"type": "string", "minLength": 1},
    "progress_trigger": {
      "type": ["string", "null"],
      "description": "ALWAYS registry_completed_event when progress is driven; null when the trigger was rejected.",
      "enum": ["registry_completed_event", null]
    },
    "verdict": {
      "type": "string",
      "enum": [
        "NEXT_ACTION_READY",
        "WAIT",
        "ALL_SETTLED",
        "NO_REGISTRY_NO_ACTION",
        "FORBIDDEN_TRIGGER_SOURCE",
        "TRACK_MISMATCH",
        "HOLD_FOR_CHAIR"
      ]
    },
    "fixed_time_used": {
      "const": false,
      "description": "Invariant — a fixed-time gate is NEVER a progress trigger."
    },
    "dead_man_used": {
      "const": false,
      "description": "Invariant — a dead-man fallback is NEVER a progress trigger."
    },
    "dead_man_signal_observed": {"type": "boolean"},
    "fallback_pending_non_blocking": {
      "const": true,
      "description": "A fallback/dead-man pending state never blocks a completed task's progress."
    },
    "authority": {
      "const": "none",
      "description": "The loop has zero dispatch/merge/write authority."
    },
    "action_mode": {
      "const": "proposal",
      "description": "Every output is a proposal — zero auto-dispatch/merge/closeout."
    },
    "events_observed": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["event_id", "event_kind", "schema_kind", "task_id"],
        "properties": {
          "event_id": {"type": "string"},
          "event_kind": {"type": "string"},
          "schema_kind": {"type": "string"},
          "task_id": {"type": ["string", "null"]},
          "batch_id": {"type": ["string", "null"]}
        },
        "additionalProperties": true
      }
    },
    "duplicate_events_suppressed": {"type": "integer", "minimum": 0},
    "single_task_results": {"type": "array", "items": {"type": "object"}},
    "batch_results": {"type": "array", "items": {"type": "object"}},
    "consolidated_summary_candidates": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["schema", "authority", "action_mode", "batch_id", "status"],
        "properties": {
          "authority": {"const": "none"},
          "action_mode": {"const": "proposal"},
          "auto_executed": {"const": false},
          "status": {"const": "CONSOLIDATED_SUMMARY_CANDIDATE_READY"}
        },
        "additionalProperties": true
      }
    },
    "dispatch_candidates": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["schema", "authority", "action_mode", "auto_executed", "anu_key_owner_required"],
        "properties": {
          "authority": {"const": "none"},
          "action_mode": {"const": "proposal"},
          "auto_executed": {"const": false},
          "anu_key_owner_required": {"const": true}
        },
        "additionalProperties": true
      }
    },
    "quarantined_events": {"type": "array", "items": {"type": "object"}},
    "hold_for_chair": {"type": "boolean"},
    "reasons": {"type": "array", "items": {"type": "string"}}
  },
  "additionalProperties": true
}
