{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:dependency-drift-check-plan-v1",
  "title": "AWOOOI dependency drift check plan v1",
  "description": "定期依賴漂移、外部 CVE / license / registry freshness 與 AI Agent 市場資料來源的只讀設計。此 schema 不授權排程啟用、外部查詢、SDK 安裝、付費 API、套件安裝、套件升級、lockfile 寫入、docker build、image pull、registry push、shadow/canary 或生產路由變更。",
  "type": "object",
  "required": [
    "schema_version",
    "generated_at",
    "program_status",
    "source_refs",
    "rollups",
    "cadence_policy",
    "local_check_plan",
    "external_source_candidates",
    "notification_policy",
    "operation_boundaries",
    "approval_boundaries"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "dependency_drift_check_plan_v1"
    },
    "generated_at": {
      "type": "string",
      "minLength": 1
    },
    "program_status": {
      "type": "object",
      "required": [
        "overall_completion_percent",
        "current_priority",
        "current_task_id",
        "next_task_id",
        "read_only_mode"
      ],
      "properties": {
        "overall_completion_percent": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "current_priority": {
          "type": "string",
          "enum": ["P0", "P1", "P2", "P3"]
        },
        "current_task_id": {
          "type": "string",
          "minLength": 1
        },
        "next_task_id": {
          "type": "string",
          "minLength": 1
        },
        "read_only_mode": {
          "type": "boolean",
          "const": true
        }
      },
      "additionalProperties": false
    },
    "source_refs": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "rollups": {
      "type": "object",
      "required": [
        "total_cadence_items",
        "total_local_checks",
        "total_external_source_candidates",
        "by_domain",
        "read_only_local_check_ids",
        "approval_required_source_ids",
        "design_only_cadence_ids"
      ],
      "properties": {
        "total_cadence_items": {
          "type": "integer",
          "minimum": 0
        },
        "total_local_checks": {
          "type": "integer",
          "minimum": 0
        },
        "total_external_source_candidates": {
          "type": "integer",
          "minimum": 0
        },
        "by_domain": {
          "type": "object",
          "additionalProperties": {
            "type": "integer",
            "minimum": 0
          }
        },
        "read_only_local_check_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "approval_required_source_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "design_only_cadence_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "additionalProperties": false
    },
    "cadence_policy": {
      "type": "object",
      "required": ["timezone", "items"],
      "properties": {
        "timezone": {
          "type": "string",
          "minLength": 1
        },
        "items": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "cadence_id",
              "domain",
              "frequency",
              "activation_status",
              "owner_agent",
              "allowed_now",
              "blocked_now",
              "planned_output",
              "failure_notification"
            ],
            "properties": {
              "cadence_id": {
                "type": "string",
                "minLength": 1
              },
              "domain": {
                "type": "string",
                "enum": ["python", "javascript", "docker", "external_sources", "agent_market", "approval_package"]
              },
              "frequency": {
                "type": "string",
                "minLength": 1
              },
              "activation_status": {
                "type": "string",
                "enum": ["design_only", "blocked_until_approval"]
              },
              "owner_agent": {
                "type": "string",
                "enum": ["openclaw", "hermes", "nemotron"]
              },
              "allowed_now": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "blocked_now": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "planned_output": {
                "type": "string",
                "minLength": 1
              },
              "failure_notification": {
                "type": "string",
                "minLength": 1
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },
    "local_check_plan": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "check_id",
          "domain",
          "status",
          "owner_agent",
          "frequency",
          "input_refs",
          "planned_output",
          "allowed_now",
          "blocked_now",
          "acceptance_criteria"
        ],
        "properties": {
          "check_id": {
            "type": "string",
            "minLength": 1
          },
          "domain": {
            "type": "string",
            "enum": ["python", "javascript", "docker", "policy", "agent_market"]
          },
          "status": {
            "type": "string",
            "enum": ["read_only_design", "blocked_until_approval"]
          },
          "owner_agent": {
            "type": "string",
            "enum": ["openclaw", "hermes", "nemotron"]
          },
          "frequency": {
            "type": "string",
            "minLength": 1
          },
          "input_refs": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "planned_output": {
            "type": "string",
            "minLength": 1
          },
          "allowed_now": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "blocked_now": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "acceptance_criteria": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "additionalProperties": false
      }
    },
    "external_source_candidates": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "source_id",
          "domain",
          "source_type",
          "approval_status",
          "auth_required",
          "cost_profile",
          "rate_limit_risk",
          "cache_policy",
          "data_retention_policy",
          "permitted_after_approval",
          "blocked_now",
          "owner_agent",
          "evidence_refs"
        ],
        "properties": {
          "source_id": {
            "type": "string",
            "minLength": 1
          },
          "domain": {
            "type": "string",
            "enum": ["cve", "license", "python_registry", "javascript_registry", "docker_registry", "agent_market"]
          },
          "source_type": {
            "type": "string",
            "minLength": 1
          },
          "approval_status": {
            "type": "string",
            "enum": ["approval_required", "blocked_until_approval"]
          },
          "auth_required": {
            "type": "boolean"
          },
          "cost_profile": {
            "type": "string",
            "enum": ["free_public_candidate", "unknown_until_review", "paid_possible"]
          },
          "rate_limit_risk": {
            "type": "string",
            "enum": ["low", "medium", "high", "unknown"]
          },
          "cache_policy": {
            "type": "string",
            "minLength": 1
          },
          "data_retention_policy": {
            "type": "string",
            "minLength": 1
          },
          "permitted_after_approval": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "blocked_now": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "owner_agent": {
            "type": "string",
            "enum": ["openclaw", "hermes", "nemotron"]
          },
          "evidence_refs": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "additionalProperties": false
      }
    },
    "notification_policy": {
      "type": "object",
      "required": ["success_notification", "failure_notification", "operator_review_trigger"],
      "properties": {
        "success_notification": {
          "type": "string",
          "minLength": 1
        },
        "failure_notification": {
          "type": "string",
          "minLength": 1
        },
        "operator_review_trigger": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "operation_boundaries": {
      "type": "object",
      "required": [
        "read_only_plan_allowed",
        "schedule_activation_allowed",
        "workflow_write_allowed",
        "external_cve_lookup_allowed",
        "external_license_lookup_allowed",
        "registry_lookup_allowed",
        "agent_market_external_lookup_allowed",
        "sdk_installation_allowed",
        "paid_api_call_allowed",
        "package_installation_allowed",
        "package_upgrade_allowed",
        "lockfile_write_allowed",
        "docker_build_allowed",
        "image_pull_allowed",
        "image_rebuild_allowed",
        "registry_push_allowed",
        "shadow_or_canary_allowed",
        "production_routing_allowed"
      ],
      "properties": {
        "read_only_plan_allowed": {
          "type": "boolean",
          "const": true
        },
        "schedule_activation_allowed": {
          "type": "boolean",
          "const": false
        },
        "workflow_write_allowed": {
          "type": "boolean",
          "const": false
        },
        "external_cve_lookup_allowed": {
          "type": "boolean",
          "const": false
        },
        "external_license_lookup_allowed": {
          "type": "boolean",
          "const": false
        },
        "registry_lookup_allowed": {
          "type": "boolean",
          "const": false
        },
        "agent_market_external_lookup_allowed": {
          "type": "boolean",
          "const": false
        },
        "sdk_installation_allowed": {
          "type": "boolean",
          "const": false
        },
        "paid_api_call_allowed": {
          "type": "boolean",
          "const": false
        },
        "package_installation_allowed": {
          "type": "boolean",
          "const": false
        },
        "package_upgrade_allowed": {
          "type": "boolean",
          "const": false
        },
        "lockfile_write_allowed": {
          "type": "boolean",
          "const": false
        },
        "docker_build_allowed": {
          "type": "boolean",
          "const": false
        },
        "image_pull_allowed": {
          "type": "boolean",
          "const": false
        },
        "image_rebuild_allowed": {
          "type": "boolean",
          "const": false
        },
        "registry_push_allowed": {
          "type": "boolean",
          "const": false
        },
        "shadow_or_canary_allowed": {
          "type": "boolean",
          "const": false
        },
        "production_routing_allowed": {
          "type": "boolean",
          "const": false
        }
      },
      "additionalProperties": false
    },
    "approval_boundaries": {
      "type": "object",
      "required": [
        "sdk_installation_allowed",
        "paid_api_call_allowed",
        "shadow_or_canary_allowed",
        "production_routing_allowed",
        "destructive_operation_allowed"
      ],
      "properties": {
        "sdk_installation_allowed": {
          "type": "boolean",
          "const": false
        },
        "paid_api_call_allowed": {
          "type": "boolean",
          "const": false
        },
        "shadow_or_canary_allowed": {
          "type": "boolean",
          "const": false
        },
        "production_routing_allowed": {
          "type": "boolean",
          "const": false
        },
        "destructive_operation_allowed": {
          "type": "boolean",
          "const": false
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
