=== META ===
{
  "id": "GTPX-RESPONSE-MODEL",
  "title": "GTPX Response Model",
  "version": "0.1.1",
  "status": "draft",
  "updated": "2026-04-26",
  "authority": "06_protocol/GTPX-RESPONSE-MODEL.gtpx",
  "type": "protocol_response",
  "project": "GTPX",
  "depends_on": [
    "06_protocol/GTPX-REQUEST-MODEL.gtpx",
    "03_language/GTPX-SYNTAX.gtpx",
    "03_language/GTPX-SEMANTICS.gtpx",
    "03_language/GTPX-ENUMS.gtpx"
  ]
}

=== DATA ===
{
  "purpose": "Defines the canonical structure of a GTPX response, including response delivery requirements for deterministic and auditable outputs.",

  "response_policy": {
    "structure_is_mandatory": true,
    "all_sections_must_exist": true,
    "missing_section_results_in_invalid": true,
    "implicit_output_is_forbidden": true
  },

  "response_delivery_policy": {
    "default_response_mode": "atomic",
    "response_mode_must_use_gtpx_enums": true,
    "response_delivery_status_must_use_gtpx_enums": true,
    "streaming_allowed_for_system_outputs": false,
    "atomic_required_for": [
      "analysis",
      "dry_run",
      "patch",
      "commit",
      "audit"
    ],
    "partial_response_is_invalid": true,
    "interrupted_response_must_be_rejected": true,
    "incomplete_response_policy": "reject"
  },

  "response_delivery_fields": {
    "required_fields": [
      "response_mode",
      "response_delivery_status",
      "complete",
      "response_hash"
    ],
    "field_definitions": {
      "response_mode": "Defines whether the response is delivered as atomic or streaming output.",
      "response_delivery_status": "Defines whether the delivered response is complete, incomplete, interrupted, invalid, or blocked.",
      "complete": "Boolean confirmation that the response is fully generated and ready for validation.",
      "response_hash": "SHA-256 hash of the complete atomic response payload, computed according to GTPX hash normalization rules."
    }
  },

  "sections": [
    "ACK",
    "STATUS",
    "SUMMARY",
    "MISSING_CONTEXT",
    "ANALYSIS",
    "RISKS",
    "PROPOSED_ACTIONS",
    "PATCH",
    "DRY_RUN",
    "NEXT_STEP"
  ],

  "section_definitions": {
    "ACK": "Confirms whether the request has been fully received and read.",
    "STATUS": "Defines the current processing state (valid, blocked, etc.).",
    "SUMMARY": "Provides a concise understanding of the request.",
    "MISSING_CONTEXT": "Lists missing data required for execution.",
    "ANALYSIS": "Provides structured reasoning output allowed by the contract.",
    "RISKS": "Lists risks, conflicts, or uncertainties.",
    "PROPOSED_ACTIONS": "Lists possible actions without committing changes.",
    "PATCH": "Defines explicit proposed changes.",
    "DRY_RUN": "Simulates output without committing.",
    "NEXT_STEP": "Defines the next valid action."
  }
}

=== RULES ===
{
  "section_order_must_follow_syntax": true,
  "all_sections_are_required": true,
  "ack_must_be_first": true,
  "status_must_be_declared": true,
  "response_must_not_skip_sections": true,
  "blocked_status_requires_missing_context": true,
  "invalid_status_requires_error_explanation": true,
  "response_mode_must_be_declared": true,
  "response_mode_must_use_gtpx_enums": true,
  "response_delivery_status_must_be_declared": true,
  "response_delivery_status_must_use_gtpx_enums": true,
  "system_outputs_must_use_atomic_response_mode": true,
  "streaming_response_is_forbidden_for_system_outputs": true,
  "incomplete_or_interrupted_response_is_invalid": true,
  "atomic_response_requires_complete_true": true,
  "atomic_response_requires_response_hash": true
}

=== STATUS ===
{
  "state": "draft",
  "open_questions": [
    "Confirm if ANALYSIS is always allowed or contract-dependent.",
    "Confirm if PATCH and DRY_RUN must always be present or conditionally used.",
    "Define exact response hash target and whether response metadata is included."
  ],
  "next_step": "Align GTPX-ACK-HASH with response delivery requirements."
}