{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json",
  "title": "Tool I/O types",
  "description": "The shared types a Tool's io.inputs/io.outputs reference by absolute IRI. Each is also published as its own document, tool-types/<Name>.schema.json (its own IRI). Generated from schemas/tools/tool-types.ts, which is authoritative.",
  "$defs": {
    "BeanId": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "pattern": "^[a-z0-9-]+$",
      "description": "A bean identifier, e.g. folio-assistant-1dfh"
    },
    "SkillName": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "pattern": "^[a-z][a-z0-9-]*$",
      "description": "A skill name, e.g. todo-manager"
    },
    "PackageName": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "pattern": "^[a-z][a-z0-9-]*$",
      "description": "A skill package, e.g. folio-core"
    },
    "ProcessId": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "pattern": "^[a-z][a-z0-9-]*$",
      "description": "A BPMN process id, e.g. crdm-requirements"
    },
    "NodeId": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "pattern": "^[A-Za-z_][A-Za-z0-9_-]*$",
      "description": "A node id within a BPMN process, e.g. A_Implement"
    },
    "InstanceId": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$",
      "description": "A workflow instance id — the stem of a file in the bean graph's workflow-state node"
    },
    "Locale": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 2,
      "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$",
      "description": "A BCP-47 language tag, e.g. en or fr-CA"
    },
    "Timestamp": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,6})?Z$",
      "description": "An ISO-8601 UTC instant, e.g. 2026-09-20T14:03:11Z"
    },
    "TimeWindow": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "pattern": "^(\\d{1,4}[hdw]|\\d{4}-\\d{2}-\\d{2})$",
      "description": "A history window: a count with a unit (4h, 2d, 1w) or an ISO date."
    },
    "Flag": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "boolean",
      "description": "A boolean switch — projects to a bare flag, with no value word"
    },
    "BeanStatus": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "draft",
        "todo",
        "in-progress",
        "completed",
        "scrapped"
      ],
      "description": "A bean status. Exactly what `beans update --status` accepts."
    },
    "RepoPath": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "pattern": "^[A-Za-z0-9._][A-Za-z0-9._/-]*$",
      "description": "A path relative to the repository root. No `..` segments."
    },
    "DelimitedTextPath": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "pattern": "^[A-Za-z0-9._][A-Za-z0-9._/-]*$",
      "description": "A repository path to a delimited text (CSV or TSV) file."
    },
    "WorkbookPath": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "pattern": "^[A-Za-z0-9._][A-Za-z0-9._/-]*$",
      "description": "A repository path to a spreadsheet workbook."
    },
    "Url": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "format": "uri",
      "description": "An absolute http(s) URL"
    },
    "Branch": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._/-]*$",
      "description": "A git branch name"
    },
    "ScriptName": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9:._-]*$",
      "description": "A package script name"
    },
    "RepoFullName": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*\\/[A-Za-z0-9][A-Za-z0-9._-]*$",
      "description": "A forge repository's full name, owner/name"
    },
    "ChangeProposalNumber": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991,
      "description": "A change-proposal number — a pull request on GitHub, a merge request on GitLab"
    },
    "ReviewThreadId": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{6,127}$",
      "description": "A review thread id — a GitHub review-thread node id or a GitLab discussion id"
    },
    "GitLabUsername": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "pattern": "^[A-Za-z0-9_](?:[A-Za-z0-9_.-]{0,253}[A-Za-z0-9_-])?$",
      "description": "A GitLab username, e.g. jane.doe"
    },
    "Markdown": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "description": "Markdown text. Not admissible as a command-line argument — see INJECTION_SAFE."
    },
    "Text": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "maxLength": 400,
      "description": "A short single-line human string. Not admissible as a command-line argument."
    },
    "FilesystemPath": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "description": "A filesystem path, possibly outside the repository. Not admissible as a command-line argument."
    },
    "Slug": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "pattern": "^[a-z0-9][a-z0-9-]*$",
      "description": "A folio slug, e.g. quantum-observable-universe"
    },
    "DocId": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$",
      "description": "A library document id, e.g. WPR-RDO-2020-003-eng"
    },
    "MountSeed": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]*=[A-Za-z0-9][A-Za-z0-9-]*\\/[A-Za-z0-9._-]+@[0-9a-f]{40}$",
      "description": "A remote instance to seed, e.g. <instance>=<owner>/<repo>@<40-hex sha>"
    },
    "MountChoice": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]*(?::[a-z0-9][a-z0-9-]*)?$",
      "description": "A mount entry and instance to write a choice to, e.g. cat-harness or cat-harness:cat-harness-tools"
    },
    "IdList": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._/-]*(?:,[A-Za-z0-9][A-Za-z0-9._/-]*)*$",
      "description": "Comma-separated ids, e.g. skills,processes/sdlc or bean-query,agent-memory"
    },
    "PinnedRepo": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9-]*\\/[A-Za-z0-9._-]+@[0-9a-f]{40}$",
      "description": "A repository at one commit, e.g. <owner>/<repo>@<40-hex sha>"
    },
    "Login": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$",
      "description": "A GitHub account name, e.g. litlfred"
    },
    "ContentType": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "paper",
        "document"
      ],
      "description": "A folio's content type. `paper` extends `document` — see AGENTS.md on content types."
    },
    "LinkMode": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "submodule",
        "sibling",
        "remote"
      ],
      "description": "How a new folio links the platform: a git submodule, a sibling checkout, or pinned remote mounts in index.config.json."
    },
    "LakeCacheAction": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "status",
        "restore",
        "restore-toolchain",
        "install-toolchain",
        "verify",
        "seed",
        "contribute",
        "list",
        "doctor"
      ],
      "description": "A lake-cache verb: restore prebuilt oleans, seed them, or diagnose why a restore missed."
    },
    "IgCacheAction": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "status",
        "restore",
        "seed",
        "contribute",
        "verify",
        "list",
        "doctor"
      ],
      "description": "An ig-cache verb: restore AST, seed it, or diagnose."
    },
    "ChangeSetAction": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "seed",
        "propose",
        "add",
        "list",
        "body",
        "adopt",
        "check",
        "reconcile",
        "github",
        "install"
      ],
      "description": "A change-set verb: check or reconcile the records, or handle one GitHub issue event."
    },
    "NamespaceLayer": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "bootstrap",
        "harness",
        "core"
      ],
      "description": "A namespace layer: bootstrap resolves before anything else, then harness, then core."
    },
    "PreferenceAction": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "get",
        "set",
        "reset"
      ],
      "description": "Read, write or clear the stored preferences."
    },
    "ArchimateModelId": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$",
      "description": "An ArchiMate model's id in cat-archimate.config.json, e.g. 0.2.0"
    },
    "ArchimateMetamodelFormat": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "text",
        "json",
        "dot",
        "mmd"
      ],
      "description": "A plain-text report, archimate-metamodel/v1 JSON, Graphviz DOT, or a Mermaid class diagram."
    },
    "CommitSha": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "pattern": "^[0-9a-f]{7,40}$",
      "description": "A git commit sha, full or abbreviated (7-40 hex digits)."
    },
    "RenderEvent": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "rendered",
        "removed",
        "restored",
        "retained"
      ],
      "description": "A render-log event: rendered, removed, restored or retained."
    },
    "RenderFormat": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "pdf",
        "html"
      ],
      "description": "A render target: pdf or html."
    },
    "PreviewFormat": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "pdf",
        "html",
        "png"
      ],
      "description": "A previewable artefact: pdf, html or png."
    },
    "RenderScope": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "full",
        "chapter",
        "section"
      ],
      "description": "How much of the folio to render."
    },
    "LatexEngine": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "pdflatex",
        "lualatex",
        "xelatex"
      ],
      "description": "The TeX engine."
    },
    "MathRenderer": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "katex",
        "mathjax"
      ],
      "description": "The browser-side math renderer."
    },
    "PrintMode": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "formal",
        "compact"
      ],
      "description": "Typesetting density."
    },
    "LinkStyle": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "blob",
        "pages",
        "raw"
      ],
      "description": "How a README link addresses its target."
    },
    "ReadmeSection": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "folio:toc",
        "folio:lean-coverage",
        "folio:lean-modules",
        "folio:simulators",
        "folio:workflows",
        "skills:index"
      ],
      "description": "A generated README section, named by its marker."
    },
    "TranslationLevel": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "block",
        "section",
        "chapter",
        "folio"
      ],
      "description": "What a translation sign-off covers."
    },
    "WireframeUse": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "enum": [
        "design",
        "as-is"
      ],
      "description": "Why a wireframe is drawn: `design` for a new or changed surface, `as-is` for an existing visualiser."
    },
    "SurfaceRef": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "string",
      "minLength": 1,
      "pattern": "^[a-z0-9][a-z0-9-]*(\\/[a-z0-9][a-z0-9-]*)*$",
      "description": "A rendered surface: a visualiser route key such as cat-harness/beans, or a kebab-case name such as navbar."
    },
    "Count": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "integer",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "A non-negative count — how many of something, or how many to show. Zero is a real answer."
    },
    "Dpi": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "integer",
      "minimum": 24,
      "maximum": 1200,
      "description": "Dots per inch for rendered formulae."
    },
    "Port": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "integer",
      "minimum": 0,
      "maximum": 65535,
      "description": "TCP port for a locally bound server; 0 asks the OS for a free one."
    },
    "DecisionFacts": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": [
          "string",
          "number",
          "boolean"
        ]
      },
      "description": "Facts for a DMN decision table. Scalar values only. Not admissible as a command-line argument."
    },
    "ProvActivity": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "@type": {
          "type": "string",
          "const": "prov:Activity"
        },
        "@id": {
          "type": "string",
          "minLength": 1
        },
        "prov:startedAtTime": {
          "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        },
        "prov:endedAtTime": {
          "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        },
        "prov:qualifiedAssociation": {
          "type": "object",
          "properties": {
            "prov:agent": {
              "type": "string",
              "minLength": 1
            },
            "prov:hadRole": {
              "type": "string",
              "minLength": 1
            },
            "prov:hadPlan": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]*#[A-Za-z_][A-Za-z0-9_.-]*$"
            }
          },
          "required": [
            "prov:agent",
            "prov:hadRole",
            "prov:hadPlan"
          ],
          "additionalProperties": false
        },
        "prov:actedOnBehalfOf": {
          "type": "string",
          "minLength": 1
        },
        "prov:used": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "object",
                "properties": {
                  "@id": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9+.-]*:\\S+$"
                  },
                  "@type": {
                    "type": "array",
                    "prefixItems": [
                      {
                        "type": "string",
                        "const": "prov:Entity"
                      },
                      {
                        "type": "string",
                        "const": "dcat:Distribution"
                      }
                    ],
                    "items": false,
                    "minItems": 2,
                    "maxItems": 2
                  },
                  "spdx:checksum": {
                    "type": "object",
                    "properties": {
                      "@type": {
                        "type": "string",
                        "const": "spdx:Checksum"
                      },
                      "spdx:algorithm": {
                        "type": "string",
                        "enum": [
                          "spdx:checksumAlgorithm_sha256",
                          "spdx:checksumAlgorithm_sha512"
                        ]
                      },
                      "spdx:checksumValue": {
                        "type": "string",
                        "pattern": "^[0-9a-f]+$"
                      }
                    },
                    "required": [
                      "spdx:algorithm",
                      "spdx:checksumValue"
                    ],
                    "additionalProperties": false
                  },
                  "dcat:downloadURL": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9+.-]*:\\S+$"
                  }
                },
                "required": [
                  "@id",
                  "@type",
                  "spdx:checksum"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "@id": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9+.-]*:\\S+$"
                  },
                  "@type": {
                    "type": "array",
                    "prefixItems": [
                      {
                        "type": "string",
                        "const": "prov:Entity"
                      },
                      {
                        "type": "string",
                        "const": "cred:VerifiableCredential"
                      }
                    ],
                    "items": false,
                    "minItems": 2,
                    "maxItems": 2
                  }
                },
                "required": [
                  "@id",
                  "@type"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "prov:generated": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "prov:wasInformedBy": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          ]
        },
        "cat-harness:underPolicy": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          ]
        },
        "cat-harness:consent": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1
            },
            "versionId": {
              "type": "string",
              "minLength": 1
            }
          },
          "required": [
            "id",
            "versionId"
          ],
          "additionalProperties": false
        },
        "cat-harness:consentBased": {
          "type": "boolean"
        },
        "cat-harness:previousHash": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "cat-harness:recordHash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      },
      "required": [
        "@type",
        "@id",
        "prov:startedAtTime",
        "prov:qualifiedAssociation",
        "cat-harness:underPolicy"
      ],
      "additionalProperties": false,
      "description": "A PROV-O activity (schemas/content/prov.ts). Structured. Not admissible as a command-line argument."
    },
    "BeanClaimCheck": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "bean": {
          "type": "string"
        },
        "state": {
          "type": "string",
          "enum": [
            "claimed",
            "would-claim",
            "skip-recent-commit",
            "skip-claim-note",
            "skip-open-pr",
            "skip-closed",
            "unknown"
          ]
        },
        "copies": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "repo": {
                "type": "string"
              },
              "ref": {
                "type": "string"
              },
              "recent": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "author": {
                      "type": "string"
                    },
                    "at": {
                      "type": "string"
                    },
                    "subject": {
                      "type": "string"
                    },
                    "session": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "author",
                    "at",
                    "subject",
                    "agent"
                  ]
                }
              },
              "status": {
                "type": "string"
              },
              "claimCommit": {
                "type": "string"
              },
              "pushAttempts": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "repo",
              "ref",
              "recent"
            ]
          }
        },
        "openWork": {
          "type": "object",
          "properties": {
            "query": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "path",
                    "prefix",
                    "bean"
                  ]
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "value"
              ]
            },
            "checkedAt": {
              "type": "string"
            },
            "hits": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "repo": {
                    "type": "string"
                  },
                  "where": {
                    "type": "string",
                    "enum": [
                      "default-branch",
                      "open-pr"
                    ]
                  },
                  "pr": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "head": {
                    "type": "string"
                  },
                  "author": {
                    "type": "string"
                  },
                  "createdAt": {
                    "type": "string"
                  },
                  "match": {
                    "type": "string",
                    "enum": [
                      "file",
                      "title",
                      "body",
                      "branch"
                    ]
                  },
                  "paths": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "repo",
                  "where",
                  "match"
                ]
              }
            },
            "unread": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "query",
            "checkedAt",
            "hits",
            "unread"
          ],
          "description": "Where a path, prefix or bean id exists on main or an open PR head; `unread` names what could not be read."
        },
        "reason": {
          "type": "string"
        }
      },
      "required": [
        "bean",
        "state",
        "copies",
        "openWork",
        "reason"
      ],
      "description": "Whether a bean was claimed, or why it was skipped, with what each copy of the work plan showed."
    },
    "DrainQueue": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "refreshedAt": {
          "type": "string"
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "repo": {
                "type": "string"
              },
              "ref": {
                "type": "string"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "repo",
              "ref",
              "sha"
            ]
          }
        },
        "byOwner": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "owner": {
                "type": "string"
              },
              "beans": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "priority": {
                      "type": "string"
                    },
                    "lastTouch": {
                      "type": "object",
                      "properties": {
                        "author": {
                          "type": "string"
                        },
                        "at": {
                          "type": "string"
                        },
                        "agent": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "author",
                        "at",
                        "agent"
                      ]
                    },
                    "skip": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "status",
                    "type",
                    "priority"
                  ]
                }
              }
            },
            "required": [
              "owner",
              "beans"
            ]
          }
        },
        "spare": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "priority": {
                "type": "string"
              },
              "lastTouch": {
                "type": "object",
                "properties": {
                  "author": {
                    "type": "string"
                  },
                  "at": {
                    "type": "string"
                  },
                  "agent": {
                    "type": "string"
                  }
                },
                "required": [
                  "author",
                  "at",
                  "agent"
                ]
              },
              "skip": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "title",
              "status",
              "type",
              "priority"
            ]
          }
        },
        "excluded": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "reason": {
                "type": "string",
                "enum": [
                  "goal",
                  "epic",
                  "blocked",
                  "completed",
                  "scrapped",
                  "draft",
                  "owner-held"
                ]
              },
              "detail": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "reason"
            ]
          }
        },
        "disagreements": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "byCopy": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "used": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "byCopy",
              "used"
            ]
          }
        }
      },
      "required": [
        "refreshedAt",
        "sources",
        "byOwner",
        "spare",
        "excluded",
        "disagreements"
      ],
      "description": "The beans that can be drained, by owner, with what was excluded and why."
    },
    "OpenWorkLookup": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "query": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "path",
                "prefix",
                "bean"
              ]
            },
            "value": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "value"
          ]
        },
        "checkedAt": {
          "type": "string"
        },
        "hits": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "repo": {
                "type": "string"
              },
              "where": {
                "type": "string",
                "enum": [
                  "default-branch",
                  "open-pr"
                ]
              },
              "pr": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "head": {
                "type": "string"
              },
              "author": {
                "type": "string"
              },
              "createdAt": {
                "type": "string"
              },
              "match": {
                "type": "string",
                "enum": [
                  "file",
                  "title",
                  "body",
                  "branch"
                ]
              },
              "paths": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "repo",
              "where",
              "match"
            ]
          }
        },
        "unread": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "query",
        "checkedAt",
        "hits",
        "unread"
      ],
      "description": "Where a path, prefix or bean id exists on main or an open PR head; `unread` names what could not be read."
    },
    "SessionSweep": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "since": {
          "type": "string"
        },
        "commitsScanned": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "sessions": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "session": {
                "type": "string"
              },
              "commits": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "first": {
                "type": "string"
              },
              "last": {
                "type": "string"
              },
              "branches": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "latestSubject": {
                "type": "string"
              }
            },
            "required": [
              "session",
              "commits",
              "first",
              "last",
              "branches",
              "latestSubject"
            ]
          }
        },
        "untrailered": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "since",
        "commitsScanned",
        "sessions",
        "untrailered"
      ],
      "description": "The sessions that committed in a window, read from Claude-Session trailers."
    },
    "BeanQueryRows": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "array",
      "items": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "type": "string"
        }
      },
      "description": "The rows a bean SPARQL query returned, each variable to its value; bean IRIs are shortened to bean ids."
    },
    "HarnessStates": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "$schema": {
            "type": "string",
            "const": "folio-harness-state/v1"
          },
          "harness": {
            "type": "string",
            "minLength": 1
          },
          "initialization": {
            "type": "object",
            "properties": {
              "position": {
                "type": "string",
                "minLength": 1
              },
              "next": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "step": {
                        "type": "string",
                        "minLength": 1
                      },
                      "action": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "step",
                      "action"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "counts": {
                "type": "object",
                "properties": {
                  "done": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "not-done": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "could-not-determine": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "stated": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "done",
                  "not-done",
                  "could-not-determine",
                  "stated"
                ],
                "additionalProperties": false
              },
              "steps": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "namedBy": {
                      "type": "string",
                      "minLength": 1
                    },
                    "what": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "done",
                        "not-done",
                        "could-not-determine",
                        "stated"
                      ]
                    },
                    "detail": {
                      "type": "string"
                    },
                    "action": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "namedBy",
                    "what",
                    "state",
                    "detail"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "position",
              "next",
              "counts",
              "steps"
            ],
            "additionalProperties": false
          },
          "health": {
            "type": "object",
            "properties": {
              "badges": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "enum": [
                        "initialization",
                        "repository"
                      ]
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "ok",
                        "finding",
                        "unknown"
                      ]
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "id",
                    "state",
                    "label"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "badges"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "$schema",
          "harness",
          "initialization",
          "health"
        ],
        "additionalProperties": false
      },
      "description": "Every harness's initialization position, next step and health badges, in name order."
    },
    "WorkflowListing": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "processes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "file": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "activities": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "error": {
                "type": "string"
              }
            },
            "required": [
              "file"
            ]
          }
        },
        "instances": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "subject": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "running",
                  "completed"
                ]
              },
              "updatedAt": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "subject",
              "status",
              "updatedAt"
            ]
          }
        }
      },
      "required": [
        "processes",
        "instances"
      ],
      "description": "The processes a folio defines (or why one cannot be read), and its open instances."
    },
    "WorkflowStarted": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "started": {
          "type": "boolean"
        },
        "position": {
          "type": "object",
          "properties": {
            "instance": {
              "type": "string"
            },
            "process": {
              "type": "string"
            },
            "processName": {
              "type": "string"
            },
            "subject": {
              "type": "string"
            },
            "bean": {
              "type": "string"
            },
            "status": {
              "type": "string",
              "enum": [
                "running",
                "completed"
              ]
            },
            "enabled": {
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "activity"
                      },
                      "node": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "lane": {
                        "type": "string"
                      },
                      "role": {
                        "type": "string"
                      },
                      "roleSkills": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "skills": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "conventions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "ref": {
                              "type": "string"
                            },
                            "scope": {
                              "type": "string",
                              "enum": [
                                "process",
                                "lane",
                                "activity"
                              ]
                            }
                          },
                          "required": [
                            "ref",
                            "scope"
                          ]
                        }
                      },
                      "touchesWorkPlan": {
                        "type": "boolean"
                      },
                      "documentation": {
                        "type": "string"
                      },
                      "calledElement": {
                        "type": "string"
                      },
                      "globalTask": {
                        "type": "string"
                      },
                      "inputs": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "phase": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "context": {
                        "type": "object",
                        "properties": {
                          "role": {
                            "type": "string"
                          },
                          "roleStack": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "effectiveSkills": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "skills": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "conventions": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "ref": {
                                  "type": "string"
                                },
                                "scope": {
                                  "type": "string",
                                  "enum": [
                                    "process",
                                    "lane",
                                    "activity"
                                  ]
                                }
                              },
                              "required": [
                                "ref",
                                "scope"
                              ]
                            }
                          },
                          "carriedBeans": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "roleStack",
                          "effectiveSkills",
                          "skills",
                          "conventions",
                          "carriedBeans"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "node",
                      "name",
                      "skills",
                      "conventions",
                      "touchesWorkPlan",
                      "context"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "decision"
                      },
                      "node": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "lane": {
                        "type": "string"
                      },
                      "role": {
                        "type": "string"
                      },
                      "outcomes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "computed": {
                        "type": "object",
                        "properties": {
                          "decision": {
                            "type": "string"
                          },
                          "facts": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "decision",
                          "facts"
                        ]
                      },
                      "phase": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "context": {
                        "type": "object",
                        "properties": {
                          "role": {
                            "type": "string"
                          },
                          "roleStack": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "effectiveSkills": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "skills": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "conventions": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "ref": {
                                  "type": "string"
                                },
                                "scope": {
                                  "type": "string",
                                  "enum": [
                                    "process",
                                    "lane",
                                    "activity"
                                  ]
                                }
                              },
                              "required": [
                                "ref",
                                "scope"
                              ]
                            }
                          },
                          "carriedBeans": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "roleStack",
                          "effectiveSkills",
                          "skills",
                          "conventions",
                          "carriedBeans"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "node",
                      "name",
                      "outcomes"
                    ]
                  }
                ]
              }
            },
            "done": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "node": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "outcome": {
                    "type": "string"
                  }
                },
                "required": [
                  "node",
                  "name"
                ]
              }
            }
          },
          "required": [
            "instance",
            "process",
            "processName",
            "subject",
            "status",
            "enabled",
            "done"
          ],
          "description": "A process instance: its subject, status, the steps enabled now with who performs them, and what is done."
        }
      },
      "required": [
        "started",
        "position"
      ],
      "description": "Whether a new instance began (false: an open one was continued), and where it now is."
    },
    "WorkflowPosition": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "instance": {
          "type": "string"
        },
        "process": {
          "type": "string"
        },
        "processName": {
          "type": "string"
        },
        "subject": {
          "type": "string"
        },
        "bean": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "running",
            "completed"
          ]
        },
        "enabled": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "activity"
                  },
                  "node": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "lane": {
                    "type": "string"
                  },
                  "role": {
                    "type": "string"
                  },
                  "roleSkills": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "skills": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "conventions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "ref": {
                          "type": "string"
                        },
                        "scope": {
                          "type": "string",
                          "enum": [
                            "process",
                            "lane",
                            "activity"
                          ]
                        }
                      },
                      "required": [
                        "ref",
                        "scope"
                      ]
                    }
                  },
                  "touchesWorkPlan": {
                    "type": "boolean"
                  },
                  "documentation": {
                    "type": "string"
                  },
                  "calledElement": {
                    "type": "string"
                  },
                  "globalTask": {
                    "type": "string"
                  },
                  "inputs": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "phase": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "role": {
                        "type": "string"
                      },
                      "roleStack": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "effectiveSkills": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "skills": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "conventions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "ref": {
                              "type": "string"
                            },
                            "scope": {
                              "type": "string",
                              "enum": [
                                "process",
                                "lane",
                                "activity"
                              ]
                            }
                          },
                          "required": [
                            "ref",
                            "scope"
                          ]
                        }
                      },
                      "carriedBeans": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "roleStack",
                      "effectiveSkills",
                      "skills",
                      "conventions",
                      "carriedBeans"
                    ]
                  }
                },
                "required": [
                  "kind",
                  "node",
                  "name",
                  "skills",
                  "conventions",
                  "touchesWorkPlan",
                  "context"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "decision"
                  },
                  "node": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "lane": {
                    "type": "string"
                  },
                  "role": {
                    "type": "string"
                  },
                  "outcomes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "computed": {
                    "type": "object",
                    "properties": {
                      "decision": {
                        "type": "string"
                      },
                      "facts": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "decision",
                      "facts"
                    ]
                  },
                  "phase": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "role": {
                        "type": "string"
                      },
                      "roleStack": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "effectiveSkills": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "skills": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "conventions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "ref": {
                              "type": "string"
                            },
                            "scope": {
                              "type": "string",
                              "enum": [
                                "process",
                                "lane",
                                "activity"
                              ]
                            }
                          },
                          "required": [
                            "ref",
                            "scope"
                          ]
                        }
                      },
                      "carriedBeans": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "roleStack",
                      "effectiveSkills",
                      "skills",
                      "conventions",
                      "carriedBeans"
                    ]
                  }
                },
                "required": [
                  "kind",
                  "node",
                  "name",
                  "outcomes"
                ]
              }
            ]
          }
        },
        "done": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "node": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "outcome": {
                "type": "string"
              }
            },
            "required": [
              "node",
              "name"
            ]
          }
        }
      },
      "required": [
        "instance",
        "process",
        "processName",
        "subject",
        "status",
        "enabled",
        "done"
      ],
      "description": "A process instance: its subject, status, the steps enabled now with who performs them, and what is done."
    },
    "WorkflowGateAnswer": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "allowed": {
          "type": "boolean"
        },
        "gate": {
          "type": "object",
          "properties": {
            "allowed": {
              "type": "boolean"
            },
            "reason": {
              "type": "string"
            },
            "relaxedBy": {
              "type": "object",
              "properties": {
                "process": {
                  "type": "string"
                },
                "activity": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "package": {
                  "type": "string"
                }
              },
              "required": [
                "process",
                "activity",
                "reason",
                "package"
              ]
            }
          },
          "required": [
            "allowed",
            "reason"
          ]
        },
        "authorization": {
          "type": "object",
          "properties": {
            "allowed": {
              "type": "boolean"
            },
            "mode": {
              "type": "string",
              "enum": [
                "advisory",
                "strict"
              ]
            },
            "authenticatedBy": {
              "type": "string",
              "enum": [
                "github",
                "http-gateway",
                "asserted",
                "none"
              ]
            },
            "actor": {
              "type": [
                "string",
                "null"
              ]
            },
            "account": {
              "type": "string"
            },
            "role": {
              "type": "string"
            },
            "assignment": {
              "type": "string",
              "enum": [
                "eligible",
                "unconstrained",
                "not-eligible",
                "no-role",
                "unknown-actor"
              ]
            },
            "authorized": {
              "type": "string",
              "enum": [
                "permit",
                "deny",
                "unknown"
              ]
            },
            "access": {
              "type": "string",
              "enum": [
                "permit",
                "deny",
                "unknown"
              ]
            },
            "findings": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "allowed",
            "mode",
            "authenticatedBy",
            "actor",
            "assignment",
            "authorized",
            "findings"
          ]
        },
        "namedActor": {
          "type": "string"
        }
      },
      "required": [
        "allowed",
        "gate",
        "authorization"
      ],
      "description": "May a step run now: the process gate and the task authorization, either of which refuses."
    },
    "WorkflowCompletion": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "position": {
          "type": "object",
          "properties": {
            "instance": {
              "type": "string"
            },
            "process": {
              "type": "string"
            },
            "processName": {
              "type": "string"
            },
            "subject": {
              "type": "string"
            },
            "bean": {
              "type": "string"
            },
            "status": {
              "type": "string",
              "enum": [
                "running",
                "completed"
              ]
            },
            "enabled": {
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "activity"
                      },
                      "node": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "lane": {
                        "type": "string"
                      },
                      "role": {
                        "type": "string"
                      },
                      "roleSkills": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "skills": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "conventions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "ref": {
                              "type": "string"
                            },
                            "scope": {
                              "type": "string",
                              "enum": [
                                "process",
                                "lane",
                                "activity"
                              ]
                            }
                          },
                          "required": [
                            "ref",
                            "scope"
                          ]
                        }
                      },
                      "touchesWorkPlan": {
                        "type": "boolean"
                      },
                      "documentation": {
                        "type": "string"
                      },
                      "calledElement": {
                        "type": "string"
                      },
                      "globalTask": {
                        "type": "string"
                      },
                      "inputs": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "phase": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "context": {
                        "type": "object",
                        "properties": {
                          "role": {
                            "type": "string"
                          },
                          "roleStack": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "effectiveSkills": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "skills": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "conventions": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "ref": {
                                  "type": "string"
                                },
                                "scope": {
                                  "type": "string",
                                  "enum": [
                                    "process",
                                    "lane",
                                    "activity"
                                  ]
                                }
                              },
                              "required": [
                                "ref",
                                "scope"
                              ]
                            }
                          },
                          "carriedBeans": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "roleStack",
                          "effectiveSkills",
                          "skills",
                          "conventions",
                          "carriedBeans"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "node",
                      "name",
                      "skills",
                      "conventions",
                      "touchesWorkPlan",
                      "context"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "decision"
                      },
                      "node": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "lane": {
                        "type": "string"
                      },
                      "role": {
                        "type": "string"
                      },
                      "outcomes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "computed": {
                        "type": "object",
                        "properties": {
                          "decision": {
                            "type": "string"
                          },
                          "facts": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "decision",
                          "facts"
                        ]
                      },
                      "phase": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "context": {
                        "type": "object",
                        "properties": {
                          "role": {
                            "type": "string"
                          },
                          "roleStack": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "effectiveSkills": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "skills": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "conventions": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "ref": {
                                  "type": "string"
                                },
                                "scope": {
                                  "type": "string",
                                  "enum": [
                                    "process",
                                    "lane",
                                    "activity"
                                  ]
                                }
                              },
                              "required": [
                                "ref",
                                "scope"
                              ]
                            }
                          },
                          "carriedBeans": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "roleStack",
                          "effectiveSkills",
                          "skills",
                          "conventions",
                          "carriedBeans"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "node",
                      "name",
                      "outcomes"
                    ]
                  }
                ]
              }
            },
            "done": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "node": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "outcome": {
                    "type": "string"
                  }
                },
                "required": [
                  "node",
                  "name"
                ]
              }
            }
          },
          "required": [
            "instance",
            "process",
            "processName",
            "subject",
            "status",
            "enabled",
            "done"
          ],
          "description": "A process instance: its subject, status, the steps enabled now with who performs them, and what is done."
        },
        "authorization": {
          "type": "object",
          "properties": {
            "allowed": {
              "type": "boolean"
            },
            "mode": {
              "type": "string",
              "enum": [
                "advisory",
                "strict"
              ]
            },
            "authenticatedBy": {
              "type": "string",
              "enum": [
                "github",
                "http-gateway",
                "asserted",
                "none"
              ]
            },
            "actor": {
              "type": [
                "string",
                "null"
              ]
            },
            "account": {
              "type": "string"
            },
            "role": {
              "type": "string"
            },
            "assignment": {
              "type": "string",
              "enum": [
                "eligible",
                "unconstrained",
                "not-eligible",
                "no-role",
                "unknown-actor"
              ]
            },
            "authorized": {
              "type": "string",
              "enum": [
                "permit",
                "deny",
                "unknown"
              ]
            },
            "access": {
              "type": "string",
              "enum": [
                "permit",
                "deny",
                "unknown"
              ]
            },
            "findings": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "allowed",
            "mode",
            "authenticatedBy",
            "actor",
            "assignment",
            "authorized",
            "findings"
          ]
        },
        "workPlan": {
          "type": "string"
        }
      },
      "required": [
        "position"
      ],
      "description": "The instance after a step was recorded, the authorization it was recorded under, and any work-plan change."
    },
    "GatesReport": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "$schema": {
          "type": "string",
          "const": "folio-gates-report/v1"
        },
        "outcome": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "not-clean",
            "undetermined"
          ]
        },
        "exitCode": {
          "anyOf": [
            {
              "type": "number",
              "const": 0
            },
            {
              "type": "number",
              "const": 1
            },
            {
              "type": "number",
              "const": 2
            }
          ]
        },
        "set": {
          "type": "string",
          "enum": [
            "fast",
            "whole"
          ]
        },
        "gates": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "writers": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "commands": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "heldOut": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "failed": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "command": {
                "type": "string"
              },
              "job": {
                "type": "string"
              },
              "step": {
                "type": "string"
              },
              "why": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "command",
              "job",
              "step",
              "why"
            ]
          }
        },
        "skipped": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "command": {
                "type": "string"
              },
              "why": {
                "type": "string"
              }
            },
            "required": [
              "command",
              "why"
            ]
          }
        },
        "mutatedBy": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "undetermined": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "unclassified": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "file": {
                "type": "string"
              },
              "command": {
                "type": "string"
              }
            },
            "required": [
              "file",
              "command"
            ]
          }
        },
        "unrun": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "$schema",
        "outcome",
        "exitCode",
        "set",
        "gates",
        "writers",
        "failed",
        "skipped",
        "mutatedBy",
        "undetermined",
        "unclassified",
        "unrun"
      ],
      "additionalProperties": false,
      "description": "One gate run: outcome and exit code, the failed gates with their salient lines, the skipped ones and why, and what changed the tree."
    },
    "MergedGatesReport": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "$schema": {
          "type": "string",
          "const": "folio-merged-gates-report/v1"
        },
        "outcome": {
          "type": "string",
          "enum": [
            "pass",
            "conflict",
            "fail",
            "not-clean",
            "undetermined"
          ]
        },
        "exitCode": {
          "anyOf": [
            {
              "type": "number",
              "const": 0
            },
            {
              "type": "number",
              "const": 1
            },
            {
              "type": "number",
              "const": 2
            }
          ]
        },
        "head": {
          "type": "string"
        },
        "base": {
          "type": "string"
        },
        "behind": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "conflicts": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "gates": {
          "type": "object",
          "properties": {
            "$schema": {
              "type": "string",
              "const": "folio-gates-report/v1"
            },
            "outcome": {
              "type": "string",
              "enum": [
                "pass",
                "fail",
                "not-clean",
                "undetermined"
              ]
            },
            "exitCode": {
              "anyOf": [
                {
                  "type": "number",
                  "const": 0
                },
                {
                  "type": "number",
                  "const": 1
                },
                {
                  "type": "number",
                  "const": 2
                }
              ]
            },
            "set": {
              "type": "string",
              "enum": [
                "fast",
                "whole"
              ]
            },
            "gates": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "writers": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "commands": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "heldOut": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "failed": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "command": {
                    "type": "string"
                  },
                  "job": {
                    "type": "string"
                  },
                  "step": {
                    "type": "string"
                  },
                  "why": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "command",
                  "job",
                  "step",
                  "why"
                ]
              }
            },
            "skipped": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "command": {
                    "type": "string"
                  },
                  "why": {
                    "type": "string"
                  }
                },
                "required": [
                  "command",
                  "why"
                ]
              }
            },
            "mutatedBy": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "undetermined": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "unclassified": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string"
                  },
                  "command": {
                    "type": "string"
                  }
                },
                "required": [
                  "file",
                  "command"
                ]
              }
            },
            "unrun": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "$schema",
            "outcome",
            "exitCode",
            "set",
            "gates",
            "writers",
            "failed",
            "skipped",
            "mutatedBy",
            "undetermined",
            "unclassified",
            "unrun"
          ],
          "additionalProperties": false
        },
        "why": {
          "type": "string"
        }
      },
      "required": [
        "$schema",
        "outcome",
        "exitCode"
      ],
      "additionalProperties": false,
      "description": "Gates on this branch merged with its base: pass, conflict (with the files), fail, not-clean or undetermined, and the inner gate run."
    }
  }
}
