{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://litlfred.github.io/bootstrap/0.1.0/schemas/discussion.output.schema.json",
  "$comment": "Generated by the bootstrap toolset (https://github.com/litlfred/bootstrap-tools, scripts/gen-bootstrap-schemas.ts) from its Zod source — do not edit; change the Zod.",
  "title": "Discussion Output",
  "description": "What the exchange determined: which harness, which repositories, on whose word, and by what means. This document existing and conforming is what finishes the task — not that a conversation took place.",
  "type": "object",
  "properties": {
    "outcome": {
      "type": "string",
      "enum": [
        "settled",
        "unsettled"
      ],
      "description": "`unsettled` is a real outcome, not an error: a participant may decline, and the process has an end for it. What an `unsettled` result must never contain is a guess."
    },
    "harness": {
      "description": "The harness this repository is to become — `bootstrap`, or any Harness built on it. Required when `outcome` is `settled` and `harness` was open.",
      "type": "string"
    },
    "repositories": {
      "description": "The repositories involved, each with the part it plays. Recorded as pairs rather than a flat list: read-from and written-to may be one repository or two, and which is which is the answer.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "Clone URL or path. Not required to be reachable — a Bootstrapping Agent may have been told about a repository it cannot yet fetch."
          },
          "role": {
            "type": "string",
            "enum": [
              "read-from",
              "written-to"
            ],
            "description": "Which part this repository plays. A flat list loses the distinction, and the distinction is the whole reason for determining them: it is where the new declaration lands."
          },
          "note": {
            "type": "string"
          }
        },
        "required": [
          "url",
          "role"
        ],
        "additionalProperties": false
      }
    },
    "determinedBy": {
      "description": "`asked` means a participant said so. `assumed` is permitted only for a default the README itself states, and then `assumption` must say which. An agent that reaches for `assumed` because nobody answered has produced an `unsettled` result, not an assumed one.",
      "type": "string",
      "enum": [
        "asked",
        "assumed"
      ]
    },
    "assumption": {
      "description": "Required when `determinedBy` is `assumed`: the documented default relied on, and where it is stated.",
      "type": "string"
    },
    "answeredBy": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "person",
            "agent"
          ]
        },
        "id": {
          "description": "Session id, handle or name, where one is known. Absent is normal for a person.",
          "type": "string"
        }
      },
      "required": [
        "kind"
      ],
      "additionalProperties": false,
      "description": "Who settled it. An answer from a sibling agent is evidence of a different weight from the person who wants the harness — both are admissible, neither is conflated with the other."
    },
    "exchange": {
      "minItems": 1,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "asked": {
            "type": "string",
            "description": "The question as put, with its candidates named. A question a reader must go and research is not ready."
          },
          "answered": {
            "description": "The reply as received. Absent means the question was put and nothing came back, which is one route to `unsettled`.",
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "asked"
        ],
        "additionalProperties": false
      },
      "description": "What was actually put and what came back, in order. One entry is the expected case — the skill's rule is to ask the fewest questions that settle it."
    },
    "stillOpen": {
      "description": "Required in substance when `outcome` is `unsettled`: what remains undetermined, so the next actor resumes rather than restarts.",
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "harness",
          "repositories"
        ]
      }
    }
  },
  "required": [
    "outcome",
    "answeredBy",
    "exchange"
  ],
  "additionalProperties": false,
  "allOf": [
    {
      "if": {
        "properties": {
          "determinedBy": {
            "const": "assumed"
          }
        },
        "required": [
          "determinedBy"
        ]
      },
      "then": {
        "required": [
          "assumption"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "outcome": {
            "const": "unsettled"
          }
        },
        "required": [
          "outcome"
        ]
      },
      "then": {
        "required": [
          "stillOpen"
        ]
      }
    }
  ]
}
