{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://awoooi.wooo.work/schemas/ai_agent_version_freshness_snapshot_v1.schema.json",
  "title": "AI Agent Version Freshness Snapshot v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "generated_at",
    "program_status",
    "scan_boundaries",
    "agent_roles",
    "repo_scan_summary",
    "daily_snapshot_design",
    "freshness_sources",
    "approval_boundaries",
    "rollups"
  ],
  "properties": {
    "schema_version": {
      "const": "ai_agent_version_freshness_snapshot_v1"
    },
    "generated_at": {
      "type": "string"
    },
    "program_status": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "overall_completion_percent",
        "current_priority",
        "current_task_id",
        "next_task_id",
        "read_only_mode",
        "runtime_authority",
        "status_note"
      ],
      "properties": {
        "overall_completion_percent": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "current_priority": {
          "type": "string"
        },
        "current_task_id": {
          "type": "string"
        },
        "next_task_id": {
          "type": "string"
        },
        "read_only_mode": {
          "const": true
        },
        "runtime_authority": {
          "const": "repo_only_snapshot_no_external_lookup_or_update"
        },
        "status_note": {
          "type": "string"
        }
      }
    },
    "scan_boundaries": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "read_only_repo_snapshot_allowed",
        "schedule_activation_allowed",
        "workflow_write_allowed",
        "external_registry_lookup_allowed",
        "external_cve_lookup_allowed",
        "package_installation_allowed",
        "package_upgrade_allowed",
        "lockfile_write_allowed",
        "docker_build_allowed",
        "image_pull_allowed",
        "host_probe_allowed",
        "auto_pr_allowed",
        "auto_merge_allowed",
        "telegram_direct_send_allowed",
        "paid_external_service_allowed",
        "production_route_change_allowed"
      ],
      "properties": {
        "read_only_repo_snapshot_allowed": {
          "const": true
        },
        "schedule_activation_allowed": {
          "const": false
        },
        "workflow_write_allowed": {
          "const": false
        },
        "external_registry_lookup_allowed": {
          "const": false
        },
        "external_cve_lookup_allowed": {
          "const": false
        },
        "package_installation_allowed": {
          "const": false
        },
        "package_upgrade_allowed": {
          "const": false
        },
        "lockfile_write_allowed": {
          "const": false
        },
        "docker_build_allowed": {
          "const": false
        },
        "image_pull_allowed": {
          "const": false
        },
        "host_probe_allowed": {
          "const": false
        },
        "auto_pr_allowed": {
          "const": false
        },
        "auto_merge_allowed": {
          "const": false
        },
        "telegram_direct_send_allowed": {
          "const": false
        },
        "paid_external_service_allowed": {
          "const": false
        },
        "production_route_change_allowed": {
          "const": false
        }
      }
    },
    "agent_roles": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "agent_id",
          "role",
          "autonomy_level",
          "outputs",
          "approval_gate"
        ],
        "properties": {
          "agent_id": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "autonomy_level": {
            "type": "string"
          },
          "outputs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "approval_gate": {
            "type": "string"
          }
        }
      }
    },
    "repo_scan_summary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "javascript_workspace_count",
        "javascript_direct_dependency_count",
        "python_manifest_count",
        "dockerfile_count",
        "runtime_surface_count",
        "committed_inventory_refs",
        "stale_committed_inventory_refs"
      ],
      "properties": {
        "javascript_workspace_count": {
          "type": "integer",
          "minimum": 0
        },
        "javascript_direct_dependency_count": {
          "type": "integer",
          "minimum": 0
        },
        "python_manifest_count": {
          "type": "integer",
          "minimum": 0
        },
        "dockerfile_count": {
          "type": "integer",
          "minimum": 0
        },
        "runtime_surface_count": {
          "type": "integer",
          "minimum": 0
        },
        "committed_inventory_refs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "stale_committed_inventory_refs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "daily_snapshot_design": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step_id",
          "sequence",
          "owner_agent",
          "allowed_now",
          "planned_output",
          "blocked_now"
        ],
        "properties": {
          "step_id": {
            "type": "string"
          },
          "sequence": {
            "type": "integer",
            "minimum": 1
          },
          "owner_agent": {
            "type": "string"
          },
          "allowed_now": {
            "const": true
          },
          "planned_output": {
            "type": "string"
          },
          "blocked_now": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "freshness_sources": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source_id",
          "domain",
          "source_type",
          "owner_agent",
          "status",
          "freshness_basis",
          "current_signal",
          "external_lookup_allowed",
          "mutation_allowed",
          "action_required",
          "evidence_refs",
          "next_action"
        ],
        "properties": {
          "source_id": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "source_type": {
            "const": "repo_only"
          },
          "owner_agent": {
            "type": "string"
          },
          "status": {
            "enum": [
              "baseline_ready",
              "action_required",
              "planned_next"
            ]
          },
          "freshness_basis": {
            "type": "string"
          },
          "current_signal": {
            "type": "string"
          },
          "external_lookup_allowed": {
            "const": false
          },
          "mutation_allowed": {
            "const": false
          },
          "action_required": {
            "type": "boolean"
          },
          "evidence_refs": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            }
          },
          "next_action": {
            "type": "string"
          }
        }
      }
    },
    "approval_boundaries": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "daily_schedule_enabled",
        "external_source_lookup_allowed",
        "package_or_model_upgrade_allowed",
        "host_or_k3s_probe_allowed",
        "telegram_digest_send_allowed",
        "gitea_pr_creation_allowed",
        "production_route_change_allowed"
      ],
      "properties": {
        "daily_schedule_enabled": {
          "const": false
        },
        "external_source_lookup_allowed": {
          "const": false
        },
        "package_or_model_upgrade_allowed": {
          "const": false
        },
        "host_or_k3s_probe_allowed": {
          "const": false
        },
        "telegram_digest_send_allowed": {
          "const": false
        },
        "gitea_pr_creation_allowed": {
          "const": false
        },
        "production_route_change_allowed": {
          "const": false
        }
      }
    },
    "rollups": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "source_count",
        "repo_only_source_count",
        "agent_count",
        "daily_step_count",
        "action_required_source_ids",
        "blocked_external_lookup_source_ids",
        "mutation_allowed_source_count",
        "schedule_enabled_count",
        "telegram_direct_send_count",
        "next_approval_task_ids"
      ],
      "properties": {
        "source_count": {
          "type": "integer",
          "minimum": 0
        },
        "repo_only_source_count": {
          "type": "integer",
          "minimum": 0
        },
        "agent_count": {
          "type": "integer",
          "minimum": 0
        },
        "daily_step_count": {
          "type": "integer",
          "minimum": 0
        },
        "action_required_source_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "blocked_external_lookup_source_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "mutation_allowed_source_count": {
          "const": 0
        },
        "schedule_enabled_count": {
          "const": 0
        },
        "telegram_direct_send_count": {
          "const": 0
        },
        "next_approval_task_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}
