{
  "$defs": {
    "DoneEvidence": {
      "description": "Evidence bundle required when a WP transitions to DONE.",
      "properties": {
        "repos": {
          "description": "At least one repo with changes",
          "items": {
            "$ref": "#/$defs/RepoEvidence"
          },
          "minItems": 1,
          "title": "Repos",
          "type": "array"
        },
        "review": {
          "$ref": "#/$defs/ReviewVerdict",
          "description": "Review verdict"
        },
        "verification": {
          "description": "Verification steps executed",
          "items": {
            "$ref": "#/$defs/VerificationEntry"
          },
          "title": "Verification",
          "type": "array"
        }
      },
      "required": [
        "repos",
        "review"
      ],
      "title": "DoneEvidence",
      "type": "object"
    },
    "ExecutionMode": {
      "description": "How a work-package is being executed.",
      "enum": [
        "worktree",
        "direct_repo"
      ],
      "title": "ExecutionMode",
      "type": "string"
    },
    "Lane": {
      "description": "Work-package lifecycle lanes.\n\n``GENESIS`` is the non-display, pre-finalize origin lane: a work-package\nwith no recorded lane events derives as ``genesis`` until ``finalize-tasks``\nseeds it to ``planned``. It is a producer-side state only \u2014 it is never a\ndisplay/summary lane and the only legal edges out of it are\n``genesis -> planned`` (the seed) and ``genesis -> canceled``.",
      "enum": [
        "genesis",
        "planned",
        "claimed",
        "in_progress",
        "for_review",
        "in_review",
        "approved",
        "done",
        "blocked",
        "canceled"
      ],
      "title": "Lane",
      "type": "string"
    },
    "RepoEvidence": {
      "description": "Evidence of repository changes for a completed work-package.",
      "properties": {
        "branch": {
          "description": "Branch name",
          "minLength": 1,
          "title": "Branch",
          "type": "string"
        },
        "commit": {
          "description": "Commit SHA or reference",
          "minLength": 1,
          "title": "Commit",
          "type": "string"
        },
        "files_touched": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "List of files modified",
          "title": "Files Touched"
        },
        "repo": {
          "description": "Repository identifier",
          "minLength": 1,
          "title": "Repo",
          "type": "string"
        }
      },
      "required": [
        "repo",
        "branch",
        "commit"
      ],
      "title": "RepoEvidence",
      "type": "object"
    },
    "ReviewVerdict": {
      "description": "Verdict from a human or automated reviewer.",
      "properties": {
        "reference": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "URL or reference for the review",
          "title": "Reference"
        },
        "reviewer": {
          "description": "Who reviewed",
          "minLength": 1,
          "title": "Reviewer",
          "type": "string"
        },
        "verdict": {
          "description": "Verdict string",
          "minLength": 1,
          "title": "Verdict",
          "type": "string"
        }
      },
      "required": [
        "reviewer",
        "verdict"
      ],
      "title": "ReviewVerdict",
      "type": "object"
    },
    "VerificationEntry": {
      "description": "A single verification step (e.g. test run, lint check).",
      "properties": {
        "command": {
          "description": "Command that was executed",
          "minLength": 1,
          "title": "Command",
          "type": "string"
        },
        "result": {
          "description": "Outcome of the command",
          "minLength": 1,
          "title": "Result",
          "type": "string"
        },
        "summary": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Human-readable summary",
          "title": "Summary"
        }
      },
      "required": [
        "command",
        "result"
      ],
      "title": "VerificationEntry",
      "type": "object"
    }
  },
  "$id": "spec-kitty-events/status_transition_payload",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Payload for a WPStatusChanged event describing a lane transition.",
  "properties": {
    "actor": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "additionalProperties": true,
          "type": "object"
        }
      ],
      "description": "Who initiated the transition. Accepts either a plain string identifier (e.g. 'claude', 'user', 'migration') or a structured dict carrying richer audit fields such as {role, profile, tool, model}. Use ``actor_label`` for a canonical string form. The status diary (``diary.decode_actor``) accepts exactly {role, profile, tool, model}, or those four plus profile_source (one of invocation, flag, agent_string, wp_frontmatter, or null; null exactly when profile is null).",
      "title": "Actor"
    },
    "evidence": {
      "anyOf": [
        {
          "$ref": "#/$defs/DoneEvidence"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Evidence bundle (required when to_lane=DONE)"
    },
    "execution_mode": {
      "$ref": "#/$defs/ExecutionMode",
      "description": "How the work-package is being executed"
    },
    "force": {
      "default": false,
      "description": "Whether this is a forced transition",
      "title": "Force",
      "type": "boolean"
    },
    "from_lane": {
      "anyOf": [
        {
          "$ref": "#/$defs/Lane"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Lane the WP is transitioning from (None for initial)"
    },
    "mission_id": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Canonical machine-facing mission identity (ULID); optional, rides alongside mission_slug so a consumer can join this moment against PhaseEntered (whose frame ref is mission_id) for the same mission aggregate (spec-kitty-events#69)",
      "title": "Mission Id"
    },
    "mission_slug": {
      "description": "Mission identifier",
      "minLength": 1,
      "title": "Mission Slug",
      "type": "string"
    },
    "reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Reason for the transition (required when force=True)",
      "title": "Reason"
    },
    "review_ref": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Reference to an external review \u2014 a pointer (review-cycle://\u2026, feedback://\u2026, auto-approval:\u2026, a PR ref), never prose (#3954: the 240-byte relay attr bound drops a prose-carrying ref whole)",
      "title": "Review Ref"
    },
    "summary": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "One-line, human-readable gist of this transition for the NOW view (spec-kitty/spec-kitty#4327). Producer-supplied and producer-validated (the CLI bounds it to one printable line of at most 240 UTF-8 bytes at creation); the zeitgeist codec projects it as the bounded ``summary`` attr and never broadcasts this raw field. The full note stays in ``reason``.",
      "title": "Summary"
    },
    "to_lane": {
      "$ref": "#/$defs/Lane",
      "description": "Lane the WP is transitioning to"
    },
    "wp_id": {
      "description": "Work-package identifier",
      "minLength": 1,
      "title": "Wp Id",
      "type": "string"
    }
  },
  "required": [
    "mission_slug",
    "wp_id",
    "to_lane",
    "actor",
    "execution_mode"
  ],
  "title": "StatusTransitionPayload",
  "type": "object"
}
